Skip to content

Commit bc0c153

Browse files
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
1 parent ea069df commit bc0c153

File tree

1 file changed

+4
-3
lines changed
  • tools/server/webui/src/lib/services

1 file changed

+4
-3
lines changed

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

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

130130
if (temperature !== undefined) requestBody.temperature = temperature;
131-
// Set max_tokens to -1 (infinite) if not provided or empty
132-
requestBody.max_tokens =
133-
max_tokens !== undefined && max_tokens !== null && max_tokens !== 0 ? max_tokens : -1;
131+
if (max_tokens !== undefined) {
132+
// Set max_tokens to -1 (infinite) when explicitly configured as 0 or null
133+
requestBody.max_tokens = max_tokens !== null && max_tokens !== 0 ? max_tokens : -1;
134+
}
134135

135136
if (dynatemp_range !== undefined) requestBody.dynatemp_range = dynatemp_range;
136137
if (dynatemp_exponent !== undefined) requestBody.dynatemp_exponent = dynatemp_exponent;

0 commit comments

Comments
 (0)