fix: AI_MAX_TOKENS/AI_TEMPERATURE 未配置时使用模型默认值,避免截断分析输出

This commit is contained in:
Sakurasan
2026-09-01 17:58:27 +08:00
parent 86429f43c2
commit d0eafe203c
2 changed files with 6 additions and 4 deletions
+4 -2
View File
@@ -80,9 +80,11 @@ async def call_llm(messages: list, tools: list = None) -> dict:
payload = {
"model": AI_MODEL,
"messages": messages,
"max_tokens": AI_MAX_TOKENS,
"temperature": AI_TEMPERATURE,
}
if AI_MAX_TOKENS is not None:
payload["max_tokens"] = AI_MAX_TOKENS
if AI_TEMPERATURE is not None:
payload["temperature"] = AI_TEMPERATURE
if tools:
payload["tools"] = tools
payload["tool_choice"] = "auto"