mirror of
https://www.modelscope.cn/ZhipuAI/GLM-4.1V-9B-Thinking.git
synced 2026-04-03 03:22:55 +08:00
33 lines
922 B
Django/Jinja
33 lines
922 B
Django/Jinja
[gMASK]<sop>
|
|
{%- for msg in messages %}
|
|
{%- if msg.role == 'system' %}
|
|
<|system|>
|
|
{{ msg.content }}
|
|
{%- elif msg.role == 'user' %}
|
|
<|user|>{{ '\n' }}
|
|
|
|
{%- if msg.content is string %}
|
|
{{ msg.content }}
|
|
{%- else %}
|
|
{%- for item in msg.content %}
|
|
{%- if item.type == 'video' or 'video' in item %}
|
|
<|begin_of_video|><|video|><|end_of_video|>
|
|
{%- elif item.type == 'image' or 'image' in item %}
|
|
<|begin_of_image|><|image|><|end_of_image|>
|
|
{%- elif item.type == 'text' %}
|
|
{{ item.text }}
|
|
{%- endif %}
|
|
{%- endfor %}
|
|
{%- endif %}
|
|
{%- elif msg.role == 'assistant' %}
|
|
{%- if msg.metadata %}
|
|
<|assistant|>{{ msg.metadata }}
|
|
{{ msg.content }}
|
|
{%- else %}
|
|
<|assistant|>
|
|
{{ msg.content }}
|
|
{%- endif %}
|
|
{%- endif %}
|
|
{%- endfor %}
|
|
{% if add_generation_prompt %}<|assistant|>
|
|
{% endif %} |