Files
QodeAssist/sources/agents/partials/anthropic_messages.jinja
2026-06-11 13:36:23 +02:00

22 lines
929 B
Django/Jinja

{% for msg in ctx.history %}
{
"role": {{ tojson(msg.role) }},
"content": [
{% for b in msg.content_blocks %}
{% if b.type == "text" %}
{ "type": "text", "text": {{ tojson(b.text) }} },
{% else if b.type == "thinking" %}
{ "type": "thinking", "thinking": {{ tojson(b.thinking) }}, "signature": {{ tojson(b.signature) }} },
{% else if b.type == "redacted_thinking" %}
{ "type": "redacted_thinking", "data": {{ tojson(b.data) }} },
{% else if b.type == "tool_use" %}
{ "type": "tool_use", "id": {{ tojson(b.id) }}, "name": {{ tojson(b.name) }}, "input": {{ tojson(b.input) }} },
{% else if b.type == "tool_result" %}
{ "type": "tool_result", "tool_use_id": {{ tojson(b.tool_use_id) }}, "content": {{ tojson(b.content) }} },
{% else if b.type == "image" %}{% include "partials/anthropic_image.jinja" %}
{% endif %}
{% endfor %}
]
},
{% endfor %}