fix(model): anthropic默认max_tokens 1024→8192 — thinking+text共享预算,长思考不再截断正文为空
CI / Backend (build / vet / test / cross-compile) (push) Has been cancelled
CI / Frontend (tsc + vite build) (push) Has been cancelled

- 根因: deepseek-v4-flash-vision-exp 为 thinking 模型, content=[thinking,text] 共享 max_tokens,默认1024被长思考吃光→仅thinking块无text块, stop_reason=max_tokens → resp.Content="" → no reply produced
- 仅当 req.MaxTokens==0 套用默认(显式值不受影响); loop→agent→anthropic 传递链无截断
- 新增 anthropic_budget_test(默认发8192 + 长思考短text断言Content=text+thinking不泄漏)
- build/vet/test绿+交叉编译
This commit is contained in:
AskaEth committed 2026-09-08 22:09:29 +08:00
1 parent f43751fd07
commit 57d5d22d87
2 files changed
+71 -1

No files matched your search

+2 -1
View File
@@ -20,7 +20,8 @@ const (
// anthropicDefaultMaxTokens is the default max_tokens sent when
// Request.MaxTokens is zero. Anthropic requires max_tokens to be present and
// positive, so a sensible default is applied rather than omitting it.
anthropicDefaultMaxTokens = 1024
// max_tokens is shared by thinking + text, so it must leave room for both.
anthropicDefaultMaxTokens = 8192
// anthropicDataPrefix marks a payload embedded as a data: URI.
anthropicDataPrefix = "data:"
)