Upload qwen3.6/chat_template.jinja with huggingface_hub
Browse files- qwen3.6/chat_template.jinja +13 -0
qwen3.6/chat_template.jinja
CHANGED
|
@@ -119,6 +119,19 @@
|
|
| 119 |
{{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
|
| 120 |
{%- elif message.role == "assistant" %}
|
| 121 |
{%- set reasoning_content = '' %}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
{%- if message.reasoning_content is string %}
|
| 123 |
{%- set reasoning_content = message.reasoning_content %}
|
| 124 |
{%- else %}
|
|
|
|
| 119 |
{{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
|
| 120 |
{%- elif message.role == "assistant" %}
|
| 121 |
{%- set reasoning_content = '' %}
|
| 122 |
+
{#- Auto-close unclosed think before tool_call -#}
|
| 123 |
+
{%- if '<think>' in content and '<tool_call>' in content %}
|
| 124 |
+
{%- set last_think = content.rfind('<think>') %}
|
| 125 |
+
{%- set last_close = content.rfind('</think>') %}
|
| 126 |
+
{%- set tool_pos = content.find('<tool_call>') %}
|
| 127 |
+
{%- if last_close < last_think or last_close == -1 %}
|
| 128 |
+
{%- if tool_pos > last_think %}
|
| 129 |
+
{%- set content = content[:tool_pos] + '</think>' + content[tool_pos:] %}
|
| 130 |
+
{%- else %}
|
| 131 |
+
{%- set content = content + '</think>' %}
|
| 132 |
+
{%- endif %}
|
| 133 |
+
{%- endif %}
|
| 134 |
+
{%- endif %}
|
| 135 |
{%- if message.reasoning_content is string %}
|
| 136 |
{%- set reasoning_content = message.reasoning_content %}
|
| 137 |
{%- else %}
|