refactor(backend): update handlers, utilities and core modules after models restructure

This commit is contained in:
fawney19
2025-12-15 14:30:53 +08:00
parent 03ee6c16d9
commit 88e37594cf
19 changed files with 121 additions and 186 deletions

View File

@@ -263,7 +263,10 @@ class ChatHandlerBase(BaseMessageHandler, ABC):
mapping = await mapper.get_mapping(source_model, provider_id)
if mapping and mapping.model:
mapped_name = str(mapping.model.provider_model_name)
# 使用 select_provider_model_name 支持别名功能
# 传入 api_key.id 作为 affinity_key实现相同用户稳定选择同一别名
affinity_key = self.api_key.id if self.api_key else None
mapped_name = mapping.model.select_provider_model_name(affinity_key)
logger.debug(f"[Chat] 模型映射: {source_model} -> {mapped_name}")
return mapped_name