feat: 现在默认不自动根据估算的费用切换apikey

This commit is contained in:
Rock Chin 2023-01-02 21:03:02 +08:00
parent a4dc661cd4
commit 36c8a5846d
2 changed files with 6 additions and 1 deletions

View File

@ -60,6 +60,10 @@ response_rules = {
# 单位:美元 # 单位:美元
api_key_fee_threshold = 18.0 api_key_fee_threshold = 18.0
# 是否根据估算的使用费用切换api-key
# 设置为False将只在接口报错超额时自动切换
auto_switch_api_key = False
# 敏感词过滤开关,以同样数量的*代替敏感词回复 # 敏感词过滤开关,以同样数量的*代替敏感词回复
# 请在sensitive.json中添加敏感词 # 请在sensitive.json中添加敏感词
sensitive_word_filter = True sensitive_word_filter = True

View File

@ -86,7 +86,8 @@ class KeysManager:
self.fee[md5] += fee self.fee[md5] += fee
if self.fee[md5] >= self.api_key_fee_threshold: if self.fee[md5] >= self.api_key_fee_threshold and \
hasattr(config, 'auto_switch_api_key') and config.auto_switch_api_key:
switch_result, key_name = self.auto_switch() switch_result, key_name = self.auto_switch()
# 检查是否切换到新的 # 检查是否切换到新的