From: Pascal Date: Thu, 9 Oct 2025 20:54:57 +0000 (+0200) Subject: webui: updated the chat service to only include max_tokens in the req… (#16489) X-Git-Tag: upstream/0.0.6764~39 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=1faa13a1187051af66b0fd9f0d6effe4c77f0b3e;p=pkg%2Fggml%2Fsources%2Fllama.cpp webui: updated the chat service to only include max_tokens in the req… (#16489) * webui: updated the chat service to only include max_tokens in the request payload when the setting is explicitly provided, while still mapping explicit zero or null values to the infinite-token sentinel * chore: update webui build output --- diff --git a/tools/server/public/index.html.gz b/tools/server/public/index.html.gz index 550df72e..5026edce 100644 Binary files a/tools/server/public/index.html.gz and b/tools/server/public/index.html.gz differ diff --git a/tools/server/webui/src/lib/services/chat.ts b/tools/server/webui/src/lib/services/chat.ts index e1dad24a..8d9dcf75 100644 --- a/tools/server/webui/src/lib/services/chat.ts +++ b/tools/server/webui/src/lib/services/chat.ts @@ -122,9 +122,10 @@ export class ChatService { requestBody.reasoning_format = currentConfig.disableReasoningFormat ? 'none' : 'auto'; if (temperature !== undefined) requestBody.temperature = temperature; - // Set max_tokens to -1 (infinite) if not provided or empty - requestBody.max_tokens = - max_tokens !== undefined && max_tokens !== null && max_tokens !== 0 ? max_tokens : -1; + if (max_tokens !== undefined) { + // Set max_tokens to -1 (infinite) when explicitly configured as 0 or null + requestBody.max_tokens = max_tokens !== null && max_tokens !== 0 ? max_tokens : -1; + } if (dynatemp_range !== undefined) requestBody.dynatemp_range = dynatemp_range; if (dynatemp_exponent !== undefined) requestBody.dynatemp_exponent = dynatemp_exponent;