fix: chat_template, keep tool-call reasoning across later user turns

#44
by dimondev - opened
Files changed (1) hide show
  1. chat_template.jinja +1 -1
chat_template.jinja CHANGED
@@ -236,7 +236,7 @@
236
 
237
  {#- Render reasoning/reasoning_content as thinking channel -#}
238
  {%- set thinking_text = message.get('reasoning') or message.get('reasoning_content') -%}
239
- {%- set thinking_gate = (loop.index0 > ns_turn.last_user_idx) or (preserve_thinking and message.get('tool_calls')) -%}
240
  {%- if thinking_text and thinking_gate -%}
241
  {{- '<|channel>thought\n' + thinking_text + '\n<channel|>' -}}
242
  {%- endif -%}
 
236
 
237
  {#- Render reasoning/reasoning_content as thinking channel -#}
238
  {%- set thinking_text = message.get('reasoning') or message.get('reasoning_content') -%}
239
+ {%- set thinking_gate = (loop.index0 > ns_turn.last_user_idx) or message.get('tool_calls') or preserve_thinking -%}
240
  {%- if thinking_text and thinking_gate -%}
241
  {{- '<|channel>thought\n' + thinking_text + '\n<channel|>' -}}
242
  {%- endif -%}