Skip to content

Commit 1faa13a

Browse files
webui: updated the chat service to only include max_tokens in the req… (ggml-org#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
1 parent 1deee0f commit 1faa13a

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

tools/server/public/index.html.gz

-8 Bytes
Binary file not shown.

tools/server/webui/src/lib/services/chat.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,10 @@ export class ChatService {
122122
requestBody.reasoning_format = currentConfig.disableReasoningFormat ? 'none' : 'auto';
123123

124124
if (temperature !== undefined) requestBody.temperature = temperature;
125-
// Set max_tokens to -1 (infinite) if not provided or empty
126-
requestBody.max_tokens =
127-
max_tokens !== undefined && max_tokens !== null && max_tokens !== 0 ? max_tokens : -1;
125+
if (max_tokens !== undefined) {
126+
// Set max_tokens to -1 (infinite) when explicitly configured as 0 or null
127+
requestBody.max_tokens = max_tokens !== null && max_tokens !== 0 ? max_tokens : -1;
128+
}
128129

129130
if (dynatemp_range !== undefined) requestBody.dynatemp_range = dynatemp_range;
130131
if (dynatemp_exponent !== undefined) requestBody.dynatemp_exponent = dynatemp_exponent;

0 commit comments

Comments
 (0)