fix(ai): extend timeout and token budget for thinking models

Thinking models like DeepSeek V4 Flash can exceed the 120s stream
timeout during long reasoning, causing truncated output and missing
answers. Increase stream timeout to 600s when thinking is enabled,
raise max_tokens floor to 8192, and bump reasoning display max-height.

Closes #326
This commit is contained in:
t8y2
2026-05-19 18:08:08 +08:00
parent d1ad53a6ca
commit 2afcfff4e3
3 changed files with 5 additions and 3 deletions
@@ -738,7 +738,7 @@ const messageRenderer = createAiMessageRenderer({ markdown: formatInlineText });
<div
class="overflow-hidden transition-all duration-200 ease-in-out"
:style="{
maxHeight: expandedReasoning.has(i) || msg.isThinking ? '2000px' : '0px',
maxHeight: expandedReasoning.has(i) || msg.isThinking ? '20000px' : '0px',
opacity: expandedReasoning.has(i) || msg.isThinking ? '1' : '0',
}"
>
+2 -1
View File
@@ -94,6 +94,7 @@ export async function runAiStream(
const sid = sessionId || uuid();
const params = actionParams(input.action);
const maxTokens = input.config.enableThinking ? Math.max(params.maxTokens, 8192) : params.maxTokens;
await api.aiStream(
sid,
@@ -101,7 +102,7 @@ export async function runAiStream(
config: input.config,
systemPrompt,
messages,
maxTokens: params.maxTokens,
maxTokens,
temperature: params.temperature,
},
(chunk) => {