Skip to content

Commit b7c7093

Browse files
author
Tianyi
committed
fix(api): 修复模型冷却时间计算逻辑
- 取最近的请求时间
1 parent 17da5ea commit b7c7093

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

api/index.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,7 @@ def filter_valid_config_model_pairs(config_model_pairs, model_request_map):
948948
if recent_fail_count > 2:
949949
# 理论上不会拿到兜底的值,因为只存了最近72小时的记录,按照断路时间算是拿不到的
950950
cooldown_seconds = fail_count_to_cooldown.get(recent_fail_count, 24 * 60 * 60)
951-
if time.time() - _model_request_history[-1].request_time / 1000 > cooldown_seconds:
951+
if time.time() - _model_request_history[0].request_time / 1000 > cooldown_seconds:
952952
# 如果已经冷却了,就直接加进去
953953
valid_config_model_pairs.append((config, actual_model))
954954
else:

0 commit comments

Comments
 (0)