Enhance configuration and model capabilities

This commit is contained in:
decolua
2026-06-16 23:32:28 +07:00
parent b282f05549
commit d03f9fb823
17 changed files with 121 additions and 52 deletions

View File

@@ -8,7 +8,7 @@ import { DEFAULT_MAX_TOKENS, DEFAULT_MIN_TOKENS } from "../../config/runtimeConf
export function adjustMaxTokens(body) {
let maxTokens = body.max_tokens || DEFAULT_MAX_TOKENS;
// Auto-increase for tool calling to prevent truncated arguments
// Auto-increase for tool calling to prevent truncated arguments (min never above max)
if (body.tools && Array.isArray(body.tools) && body.tools.length > 0) {
if (maxTokens < DEFAULT_MIN_TOKENS) {
maxTokens = DEFAULT_MIN_TOKENS;
@@ -22,6 +22,9 @@ export function adjustMaxTokens(body) {
maxTokens = body.thinking.budget_tokens + 1024;
}
// Never exceed the global ceiling
if (maxTokens > DEFAULT_MAX_TOKENS) maxTokens = DEFAULT_MAX_TOKENS;
return maxTokens;
}