cli : fix --reasoning-budget and --chat-template-kwargs being ignored

The autoparser refactor (#18675) replaced `chat_params.enable_thinking`
with `common_chat_templates_support_enable_thinking()`, which only
checks template support and ignores the user's flags. Also missing
was the chat_template_kwargs passthrough.

Fixes #20182
This commit is contained in:
Trevor Strieber 2026-03-09 22:28:22 -07:00
parent c96f608d98
commit e0e9c747a7
1 changed files with 14 additions and 1 deletions

View File

@ -193,7 +193,20 @@ struct cli_context {
inputs.parallel_tool_calls = false;
inputs.add_generation_prompt = true;
inputs.reasoning_format = COMMON_REASONING_FORMAT_DEEPSEEK;
inputs.enable_thinking = common_chat_templates_support_enable_thinking(chat_params.tmpls.get());
inputs.enable_thinking = chat_params.enable_thinking;
inputs.chat_template_kwargs = chat_params.chat_template_kwargs;
// sync enable_thinking with kwargs (mirrors server-common.cpp)
{
auto it = inputs.chat_template_kwargs.find("enable_thinking");
if (it != inputs.chat_template_kwargs.end()) {
if (it->second == "true") {
inputs.enable_thinking = true;
} else if (it->second == "false") {
inputs.enable_thinking = false;
}
}
}
// Apply chat template to the list of messages
return common_chat_templates_apply(chat_params.tmpls.get(), inputs);