diff --git a/server/chat_flow_helpers.py b/server/chat_flow_helpers.py index c5b09e7..57a926a 100644 --- a/server/chat_flow_helpers.py +++ b/server/chat_flow_helpers.py @@ -65,18 +65,18 @@ async def _generate_title_async( return None client = DeepSeekClient(thinking_mode=False, web_mode=True) - title_base = _env_optional("AGENT_TITLE_API_BASE_URL") - title_key = _env_optional("AGENT_TITLE_API_KEY") - title_model = _env_optional("AGENT_TITLE_MODEL_ID") - if title_base: - client.fast_api_config["base_url"] = title_base - client.api_base_url = title_base - if title_key: - client.fast_api_config["api_key"] = title_key - client.api_key = title_key - if title_model: - client.fast_api_config["model_id"] = title_model - client.model_id = title_model + # 对话标题生成使用独立模型配置(支持 config 默认值 + .env 覆盖) + title_base = _env_optional("AGENT_TITLE_API_BASE_URL") or TITLE_API_BASE_URL + title_key = _env_optional("AGENT_TITLE_API_KEY") or TITLE_API_KEY + title_model = _env_optional("AGENT_TITLE_MODEL_ID") or TITLE_MODEL_ID + client.fast_api_config = { + "base_url": title_base, + "api_key": title_key, + "model_id": title_model, + } + client.api_base_url = title_base + client.api_key = title_key + client.model_id = title_model _title_debug_log("start_generate_title", user_message_preview=str(user_message)[:200], user_message_len=len(str(user_message))) _title_debug_log( "title_api_config",