feat((model api key) and app):

1. model api key call log;
2. model api key Load Balancing Call Policy Implementation;
3. the API call statistics interface under the home page space
This commit is contained in:
Timebomb2018
2026-02-05 14:22:52 +08:00
parent 0632d7611f
commit b569d77a23
13 changed files with 182 additions and 36 deletions

View File

@@ -537,7 +537,7 @@ def convert_multi_agent_config_to_handoffs(
# 获取该 Agent 的模型配置
if release.default_model_config_id:
model_api_key = ModelApiKeyService.get_a_api_key(db, release.default_model_config_id)
model_api_key = ModelApiKeyService.get_available_api_key(db, release.default_model_config_id)
if model_api_key:
model_config = RedBearModelConfig(
model_name=model_api_key.model_name,
@@ -551,6 +551,7 @@ def convert_multi_agent_config_to_handoffs(
}
)
logger.debug(f"Agent {agent_name} 使用模型: {model_api_key.model_name}")
ModelApiKeyService.record_api_key_usage(db, model_api_key.id)
else:
logger.warning(f"Agent {agent_name} 模型配置无效: {release.default_model_config_id}")
else: