fix: AI_MAX_TOKENS/AI_TEMPERATURE 未配置时使用模型默认值,避免截断分析输出
This commit is contained in:
@@ -8,5 +8,5 @@ load_dotenv()
|
||||
AI_API_BASE = os.getenv("AI_API_BASE", "https://openteam.oneisall.xyz/v1")
|
||||
AI_API_KEY = os.getenv("AI_API_KEY", "")
|
||||
AI_MODEL = os.getenv("AI_MODEL", "deepseek-v4-flash")
|
||||
AI_MAX_TOKENS = int(os.getenv("AI_MAX_TOKENS", "4096"))
|
||||
AI_TEMPERATURE = float(os.getenv("AI_TEMPERATURE", "0.7"))
|
||||
AI_MAX_TOKENS = int(os.getenv("AI_MAX_TOKENS")) if os.getenv("AI_MAX_TOKENS") else None
|
||||
AI_TEMPERATURE = float(os.getenv("AI_TEMPERATURE")) if os.getenv("AI_TEMPERATURE") else None
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user