anonymous-2321 commited on
Commit
857b5be
·
verified ·
1 Parent(s): f0bab53

Update chat_template.jinja

Browse files
Files changed (1) hide show
  1. chat_template.jinja +7 -8
chat_template.jinja CHANGED
@@ -35,14 +35,14 @@
35
  {%- if message.reasoning_content is string %}
36
  {%- set reasoning_content = message.reasoning_content %}
37
  {%- else %}
38
- {%- if '</think>' in content %}
39
- {%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
40
- {%- set content = content.split('</think>')[-1].lstrip('\n') %}
41
  {%- endif %}
42
  {%- endif %}
43
  {%- if loop.index0 > ns.last_query_index %}
44
  {%- if loop.last or (not loop.last and reasoning_content) %}
45
- {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
46
  {%- else %}
47
  {{- '<|im_start|>' + message.role + '\n' + content }}
48
  {%- endif %}
@@ -82,8 +82,7 @@
82
  {%- endif %}
83
  {%- endfor %}
84
  {%- if add_generation_prompt %}
85
- {{- '<|im_start|>assistant\n' }}
86
- {%- if enable_thinking is defined and enable_thinking is false %}
87
- {{- '<think>\n\n</think>\n\n' }}
88
- {%- endif %}
89
  {%- endif %}
 
35
  {%- if message.reasoning_content is string %}
36
  {%- set reasoning_content = message.reasoning_content %}
37
  {%- else %}
38
+ {%- if '</reasoning>' in content %}
39
+ {%- set reasoning_content = content.split('</reasoning>')[0].rstrip('\n').split('<reasoning>')[-1].lstrip('\n') %}
40
+ {%- set content = content.split('</reasoning>')[-1].lstrip('\n') %}
41
  {%- endif %}
42
  {%- endif %}
43
  {%- if loop.index0 > ns.last_query_index %}
44
  {%- if loop.last or (not loop.last and reasoning_content) %}
45
+ {{- '<|im_start|>' + message.role + '\n<reasoning>\n' + reasoning_content.strip('\n') + '\n</reasoning>\n\n' + content.lstrip('\n') }}
46
  {%- else %}
47
  {{- '<|im_start|>' + message.role + '\n' + content }}
48
  {%- endif %}
 
82
  {%- endif %}
83
  {%- endfor %}
84
  {%- if add_generation_prompt %}
85
+ {{- '<|im_start|>assistant\n<think>\n\n</think>\n\n<reasoning>\n'}}
86
+ {%- else %}
87
+ {{- '<|im_start|>assistant\n<think>\n\n</think>\n\n'}}
 
88
  {%- endif %}