Add a dashed-border banner between User Input and Response cards that
copies both response content and reasoning content in a combined format:
---
Response:
{response}
---
Reasoning:
{reasoning}
- template/turn_detail.html: conditional banner (only when reasoning exists)
- static/hermes-trace.css: .detail-card-banner styles (dashed border, hover
accent)
- static/hermes-trace.js: click handler + _copyResponsePlusReasoning() that
scans DOM for Response/Reasoning cards and combines their <pre> content
240 lines
11 KiB
HTML
240 lines
11 KiB
HTML
<div id="turn-detail-content" data-turn-id="{{ turn.id }}" x-data="turnDetail({ turnId: {{ turn.id }}, focusTc: {{ focus_tc if focus_tc is not none else 'null' }} })">
|
|
|
|
{# ── Header ── #}
|
|
<div class="detail-overlay-header">
|
|
<div class="detail-title">
|
|
{% if tool_name %}
|
|
<span>Tool: <span style="color:var(--yellow);">{{ tool_name }}</span></span>
|
|
<span class="detail-title-id">· Parent LLM #{{ order_num }} · Turn ID #{{ turn.id }}</span>
|
|
{% elif order_num %}
|
|
<span>LLM #{{ order_num }}</span>
|
|
<span class="detail-title-id">· Turn ID #{{ turn.id }}</span>
|
|
{% else %}
|
|
<span>Turn #{{ turn.id }}</span>
|
|
{% endif %}
|
|
<span class="detail-title-model">
|
|
<span class="badge badge-dim" style="max-width:160px;overflow:hidden;text-overflow:ellipsis;display:inline-block;">{{ turn.model or "—" }}</span>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
|
|
{# ── Metadata chips ── #}
|
|
<div class="chip-bar">
|
|
{# Latency #}
|
|
<span class="chip">
|
|
<span class="chip-label">Latency</span>
|
|
<span class="chip-num">
|
|
{% if turn.elapsed_ms is not none and turn.elapsed_ms >= 1000 %}
|
|
{{ "%.1f" | format(turn.elapsed_ms / 1000) }}s
|
|
{% elif turn.elapsed_ms is not none %}
|
|
{{ turn.elapsed_ms }}ms
|
|
{% else %}
|
|
—
|
|
{% endif %}
|
|
</span>
|
|
</span>
|
|
|
|
{# Token: prompt → completion #}
|
|
<span class="chip" x-data="{ showTokens: false }"
|
|
tabindex="0"
|
|
@mouseenter="showTokens = true"
|
|
@mouseleave="showTokens = false"
|
|
@focus="showTokens = true"
|
|
@blur="showTokens = false">
|
|
<span class="chip-label">Tokens</span>
|
|
<span class="chip-num">
|
|
{% if turn.input_tokens is not none %}
|
|
{{ turn.input_tokens | commas }} prompt
|
|
{% else %}?{% endif %}
|
|
→
|
|
{% if turn.output_tokens is not none %}
|
|
{{ turn.output_tokens | commas }} completion
|
|
{% else %}?{% endif %}
|
|
</span>
|
|
{# ── Usage breakdown tooltip ── #}
|
|
<div class="chip-tooltip" x-show="showTokens" x-cloak
|
|
@click.outside="showTokens = false"
|
|
x-transition:enter.duration.100ms>
|
|
<div class="chip-tooltip-title">Usage breakdown</div>
|
|
<div class="chip-tooltip-section">
|
|
<div class="chip-tooltip-section-hdr">Input usage <span class="chip-tt-total">{{ toks.input_usage_total | commas }}</span></div>
|
|
{% if toks.cache_read is not none %}
|
|
<div class="chip-tooltip-row"><span>cache_read_input_tokens</span><span>{{ toks.cache_read | commas }}</span></div>
|
|
{% endif %}
|
|
<div class="chip-tooltip-row"><span>input</span><span>{{ toks.input | commas }}</span></div>
|
|
</div>
|
|
<div class="chip-tooltip-section">
|
|
<div class="chip-tooltip-section-hdr">Output usage <span class="chip-tt-total">{{ toks.output_usage_total | commas }}</span></div>
|
|
<div class="chip-tooltip-row"><span>output</span><span>{{ toks.output | commas }}</span></div>
|
|
</div>
|
|
{% if toks.reasoning is not none %}
|
|
<div class="chip-tooltip-divider"></div>
|
|
<div class="chip-tooltip-row"><span>reasoning_tokens</span><span>{{ toks.reasoning | commas }}</span></div>
|
|
{% endif %}
|
|
<div class="chip-tooltip-footer">
|
|
<span>Total usage</span>
|
|
<span class="chip-tt-total">{{ toks.total | commas }}</span>
|
|
</div>
|
|
</div>
|
|
</span>
|
|
|
|
{# Total tokens (Σ) #}
|
|
{% if turn.total_tokens is not none %}
|
|
<span class="chip">
|
|
<span class="chip-label">Σ</span>
|
|
<span class="chip-num">{{ turn.total_tokens | commas }}</span>
|
|
</span>
|
|
{% endif %}
|
|
|
|
{# Finish reason #}
|
|
<span class="chip">
|
|
<span class="chip-label">Finish</span>
|
|
{% set fr = turn.finish_reason or "" %}
|
|
<span class="chip-fr fr-{{ fr }}">{{ fr or "—" }}</span>
|
|
</span>
|
|
|
|
{# Turn type #}
|
|
<span class="chip">
|
|
<span class="chip-label">Type</span>
|
|
<span class="chip-num">{{ turn.turn_type or "main" }}</span>
|
|
</span>
|
|
</div>
|
|
|
|
{# ── Tabs ── #}
|
|
<div class="detail-tabs">
|
|
<button class="detail-tab" :class="{ active: tab === 'preview' }" @click="tab = 'preview'">Preview</button>
|
|
<button class="detail-tab" :class="{ active: tab === 'json' }" @click="tab = 'json'; loadJson();">JSON</button>
|
|
</div>
|
|
|
|
{# ── Tab: Preview ── #}
|
|
<div class="detail-tab-content" x-show="tab === 'preview'">
|
|
<div class="tab-pane">
|
|
|
|
{# User Input #}
|
|
<div class="detail-card">
|
|
<div class="detail-card-header">
|
|
<span>User Input</span>
|
|
<button class="copy-btn" title="Copy User Input">📋</button>
|
|
</div>
|
|
<div class="detail-card-body detail-card-scroll">
|
|
<pre>{{ user_input or "(no user input)" }}</pre>
|
|
</div>
|
|
</div>
|
|
|
|
{# ── Copy Response + Reasoning banner ── #}
|
|
{% if turn.reasoning %}
|
|
<div class="detail-card-banner" title="Copy Response + Reasoning">
|
|
<span>📋</span>
|
|
<span>Copy Response + Reasoning</span>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{# Response #}
|
|
<div class="detail-card">
|
|
<div class="detail-card-header">
|
|
<span>Response</span>
|
|
<button class="copy-btn" title="Copy Response">📋</button>
|
|
</div>
|
|
<div class="detail-card-body detail-card-scroll response-scroll">
|
|
<pre>{{ response_content or "(no response)" }}</pre>
|
|
</div>
|
|
</div>
|
|
|
|
{# ── Reasoning (if present) ── #}
|
|
{% if turn.reasoning %}
|
|
<div class="detail-card">
|
|
<div class="detail-card-header">
|
|
<span>Reasoning{% if turn.reasoning_tokens is not none %} <span class="badge badge-dim" style="margin-left:6px;font-size:10px;">{{ turn.reasoning_tokens }} tokens</span>{% endif %}</span>
|
|
<button class="copy-btn" title="Copy Reasoning">📋</button>
|
|
</div>
|
|
<div class="detail-card-body detail-card-scroll">
|
|
<pre>{{ turn.reasoning }}</pre>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{# ── Tool calls (if any) ── #}
|
|
{% if turn.tool_calls and turn.tool_calls|length > 0 %}
|
|
{% for tc in turn.tool_calls %}
|
|
{% set ptc = pretty_tool_calls[loop.index0] if pretty_tool_calls and loop.index0 < pretty_tool_calls|length else None %}
|
|
<div class="tc-card" id="tc-{{ tc.id }}">
|
|
<div class="tc-card-header">
|
|
<span class="tc-card-name">#{{ tc.call_order }}: {{ tc.name }}</span>
|
|
{% if tc.duration_ms is not none %}
|
|
<span class="tc-card-latency">{{ tc.duration_ms }}ms</span>
|
|
{% endif %}
|
|
</div>
|
|
<div class="tc-card-body">
|
|
{# Arguments #}
|
|
<div class="detail-card" x-data="{ raw: false }">
|
|
<div class="detail-card-header">
|
|
<span>Arguments</span>
|
|
<div style="display:flex;align-items:center;gap:4px;margin-left:auto;">
|
|
<button class="copy-btn" title="Copy Tool Arguments">📋</button>
|
|
<button @click="raw = !raw" class="json-toggle" x-text="raw ? '{} Pretty' : '{ } Raw'" x-bind:class="{ 'json-toggle-on': !raw }" style="font-size:9px;padding:1px 6px;"></button>
|
|
</div>
|
|
</div>
|
|
<div class="detail-card-body">
|
|
<pre x-show="!raw" class="td-pre" style="margin:0;background:none;border:none;padding:0;max-height:180px;overflow-y:auto;">{{ (ptc.args_pretty if ptc and ptc.args_pretty else tc.args) | nl }}</pre>
|
|
<pre x-show="raw" class="td-pre copy-raw" style="margin:0;background:none;border:none;padding:0;max-height:180px;overflow-y:auto;white-space:pre;overflow-x:auto;">{{ tc.args }}</pre>
|
|
</div>
|
|
</div>
|
|
|
|
{# Result #}
|
|
<div class="detail-card" x-data="{ raw2: false }">
|
|
<div class="detail-card-header">
|
|
<span>Result</span>
|
|
<div style="display:flex;align-items:center;gap:4px;margin-left:auto;">
|
|
<button class="copy-btn" title="Copy Tool Result">📋</button>
|
|
<button @click="raw2 = !raw2" class="json-toggle" x-text="raw2 ? '{} Pretty' : '{ } Raw'" x-bind:class="{ 'json-toggle-on': !raw2 }" style="font-size:9px;padding:1px 6px;"></button>
|
|
</div>
|
|
</div>
|
|
<div class="detail-card-body">
|
|
<pre x-show="!raw2" class="td-pre" style="margin:0;background:none;border:none;padding:0;max-height:240px;overflow-y:auto;">{{ (ptc.result_pretty if ptc and ptc.result_pretty else tc.result) | nl }}</pre>
|
|
<pre x-show="raw2" class="td-pre copy-raw" style="margin:0;background:none;border:none;padding:0;max-height:240px;overflow-y:auto;white-space:pre;overflow-x:auto;">{{ tc.result }}</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
{% else %}
|
|
<div class="tc-card-empty">No tool calls.</div>
|
|
{% endif %}
|
|
|
|
</div>
|
|
</div>
|
|
|
|
{# ── Tab: JSON ── #}
|
|
<div class="detail-tab-content" x-show="tab === 'json'">
|
|
<div class="tab-pane">
|
|
|
|
{# Full Request #}
|
|
<div class="json-section">
|
|
<div class="json-section-header">
|
|
<span>Full Request</span>
|
|
<div style="display:flex;align-items:center;gap:4px;margin-left:auto;">
|
|
<button class="copy-btn" title="Copy Full Request">📋</button>
|
|
</div>
|
|
</div>
|
|
<div class="json-section-body" id="json-request">
|
|
<div class="json-empty">Loading...</div>
|
|
</div>
|
|
</div>
|
|
|
|
{# Full Response #}
|
|
<div class="json-section">
|
|
<div class="json-section-header">
|
|
<span>Full Response</span>
|
|
<div style="display:flex;align-items:center;gap:4px;margin-left:auto;">
|
|
<button class="copy-btn" title="Copy Full Response">📋</button>
|
|
</div>
|
|
</div>
|
|
<div class="json-section-body" id="json-response">
|
|
<div class="json-empty">Loading...</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|