{# partials/_response.html Renders the response / error / guardrail section of a result entry. Expects: entry, truncated (bool), process_text(), text_to_colour() #} {% if entry.guardrail %} {% elif entry.error and entry.error != "" %} {% elif entry.response is sequence and entry.response is not string and entry.response is not mapping %} {# List of messages — render as conversation thread #} {% set _response_size = entry.response | length %} {% set _response_expanded = not truncated or _response_size <= 8 %}
Response conversation · {{ _response_size }} messages
{% for message in entry.response %} {% if message is mapping %}
{% for key, value in message.items() %}
{{ key | upper }}
{{ process_text(value, truncated=false)|e }}
{% endfor %}
{% else %}
{{ process_text(message, truncated=false)|e }}
{% endif %} {% endfor %}
{% elif entry.response is mapping %} {# Dict response — pretty-printed JSON #}
Response — structured JSON object
{% else %}
Response
{{ process_text(entry.response, truncated=truncated)|e }}
{% endif %}