Prevent whitespace leakage in beginning of prompt
Browse filesThe current chat template leaks indentation and newlines at the beginning of the system message for every single turn of conversation. Prompt caching would still work in servers that trim, but would be uncacheable otherwise. This is a minor fix — no behavioral differences. Just no extra leading whitespace.
- chat_template.jinja +5 -5
chat_template.jinja
CHANGED
|
@@ -51,11 +51,11 @@
|
|
| 51 |
{%- set conversation_messages = messages[1:] -%}
|
| 52 |
{%- endif -%}
|
| 53 |
{#- Get the last user message turn, for interleved thinking -#}
|
| 54 |
-
{%- set ns = namespace(last_user_index=-1) %}
|
| 55 |
-
{% for m in conversation_messages %}
|
| 56 |
-
{%- if m.role == 'user' %}
|
| 57 |
-
{% set ns.last_user_index = loop.index0 -%}
|
| 58 |
-
{%- endif %}
|
| 59 |
{%- endfor %}
|
| 60 |
{#- Render system message -#}
|
| 61 |
{{- ']~!b[' ~ ']~b]system' ~ '\n' }}
|
|
|
|
| 51 |
{%- set conversation_messages = messages[1:] -%}
|
| 52 |
{%- endif -%}
|
| 53 |
{#- Get the last user message turn, for interleved thinking -#}
|
| 54 |
+
{%- set ns = namespace(last_user_index=-1) -%}
|
| 55 |
+
{%- for m in conversation_messages -%}
|
| 56 |
+
{%- if m.role == 'user' -%}
|
| 57 |
+
{%- set ns.last_user_index = loop.index0 -%}
|
| 58 |
+
{%- endif -%}
|
| 59 |
{%- endfor %}
|
| 60 |
{#- Render system message -#}
|
| 61 |
{{- ']~!b[' ~ ']~b]system' ~ '\n' }}
|