lucianommartins commited on
Commit
aee1cb7
·
verified ·
1 Parent(s): 1f9aeb9

fix: remove APC primer from history, scope preserve_thinking to tool-call turns

Browse files
Files changed (1) hide show
  1. chat_template.jinja +2 -4
chat_template.jinja CHANGED
@@ -226,14 +226,12 @@
226
  {%- set continue_same_model_turn = (role == 'model' and ns.prev_non_tool_role == 'assistant') -%}
227
  {%- if not continue_same_model_turn -%}
228
  {{- '<|turn>' + role + '\n' }}
229
- {%- if role == 'model' and not enable_thinking and not (message.get('reasoning') or message.get('reasoning_content')) -%}
230
- {{- '<|channel>thought\n<channel|>' -}}
231
- {%- endif -%}
232
  {%- endif -%}
233
 
234
  {#- Render reasoning/reasoning_content as thinking channel -#}
235
  {%- set thinking_text = message.get('reasoning') or message.get('reasoning_content') -%}
236
- {%- set thinking_gate = (loop.index0 > ns_turn.last_user_idx) or preserve_thinking -%}
237
  {%- if thinking_text and thinking_gate -%}
238
  {{- '<|channel>thought\n' + thinking_text + '\n<channel|>' -}}
239
  {%- endif -%}
 
226
  {%- set continue_same_model_turn = (role == 'model' and ns.prev_non_tool_role == 'assistant') -%}
227
  {%- if not continue_same_model_turn -%}
228
  {{- '<|turn>' + role + '\n' }}
229
+
 
 
230
  {%- endif -%}
231
 
232
  {#- Render reasoning/reasoning_content as thinking channel -#}
233
  {%- set thinking_text = message.get('reasoning') or message.get('reasoning_content') -%}
234
+ {%- set thinking_gate = (loop.index0 > ns_turn.last_user_idx) or (preserve_thinking and message.get('tool_calls')) -%}
235
  {%- if thinking_text and thinking_gate -%}
236
  {{- '<|channel>thought\n' + thinking_text + '\n<channel|>' -}}
237
  {%- endif -%}