Files
enkly-ai/services/gateway/web/templates/deliverables.html
enkly 79ce8dc4c0
Some checks failed
Go CI Pipeline / build_and_test (push) Failing after 22m0s
Init Project
2026-10-30 18:06:55 +01:00

44 lines
2.0 KiB
HTML

{{/*
Download cards shown at the end of an agent reply (see
internal/handlers/deliverables.go). Data: []deliverableView.
A card with DownloadURL is a real link to a workspace file; one without
is a code-snippet card whose button is handled by app.js.
*/}}
{{ define "deliverables" }}
<div class="deliverables">
{{ range . }}
<div class="deliverable-card">
<div class="deliverable-tile" aria-hidden="true">
<svg viewBox="0 0 24 24" width="26" height="26" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><path d="M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z"/><path d="M14 3v5h5"/><path d="M9 13h6M9 17h4"/></svg>
</div>
<div class="deliverable-meta">
<div class="deliverable-name" title="{{ .Name }}">{{ .Name }}</div>
<div class="deliverable-type">{{ .TypeLabel }}{{ if .Detail }} · {{ .Detail }}{{ end }}</div>
</div>
{{ if .DownloadURL }}
<a class="deliverable-btn" href="{{ .DownloadURL }}" download>Download</a>
{{ else }}
<button type="button" class="deliverable-btn snippet-download" data-snippet-index="{{ .SnippetIndex }}" data-filename="{{ .Name }}">Download</button>
{{ end }}
</div>
{{ end }}
</div>
{{ end }}
{{/*
The SSE "deliverable" payload — one produced file's download card,
sent as soon as the tool call that created or changed it completes
(see internal/handlers/chat.go's TurnEvent_ToolCall case and
liveDeliverable), not only once the whole turn finishes. Same
hx-swap-oob mechanism as message.html's "tool_call_oob": "beforebegin"
on the assistant row puts the card above the still-streaming bubble,
right after the tool card that produced it. Data: StreamID, Views
([]deliverableView — always length 1 here, but "deliverables" above
already ranges over a slice, so it's reused as-is).
*/}}
{{ define "deliverable_oob" }}
<div hx-swap-oob="beforebegin:#assistant-row-{{ .StreamID }}">
{{ template "deliverables" .Views }}
</div>
{{ end }}