Open
Conversation
这个修改解决了几个关键问题:
1 修复了 * 通配符的权重展开逻辑:原代码中 weights_dict.update({provider_name + "/" + model_name: int(value) for model_item in model_dict.keys()}) 实际上只会为一个模型设置权重,现在改为正确的循环展开。
2 支持 all 与权重配置共存:当配置中同时存在权重模型和 all 时,会为所有未配置权重的模型设置默认权重1。
3 保持向后兼容性:不影响现有的纯权重配置或纯字符串配置。
现在你的配置可以正常工作:
api_keys:
- api: sk-xxx
model:
- all
- gemini/*: 9
preferences:
SCHEDULING_ALGORITHM: weighted_round_robin
AUTO_RETRY: true
这样配置后:
• gemini/* 下的所有模型都会有权重9
• 其他所有模型会有默认权重1
• 权重轮询算法会按照这些权重比例分配请求
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
这个修改解决了几个关键问题:
1 修复了 * 通配符的权重展开逻辑:原代码中 weights_dict.update({provider_name + "/" + model_name: int(value) for model_item in model_dict.keys()}) 实际上只会为一个模型设置权重,现在改为正确的循环展开。
2 支持 all 与权重配置共存:当配置中同时存在权重模型和 all 时,会为所有未配置权重的模型设置默认权重1。
3 保持向后兼容性:不影响现有的纯权重配置或纯字符串配置。
现在你的配置可以正常工作:
api_keys:
这样配置后:
• gemini/* 下的所有模型都会有权重9
• 其他所有模型会有默认权重1
• 权重轮询算法会按照这些权重比例分配请求