Files
enkly-ai/services/gateway/web/templates/attachments.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

35 lines
1.7 KiB
HTML

{{/*
The small gallery of files attached to a user message (see
internal/handlers/attachments.go's renderUserMessage, which appends
this after the escaped prompt text — the same trick
deliverables.go uses to append download cards to an assistant
reply). Data: []attachmentChipView. An archive chip (IsArchive) has
no DownloadURL — it's a folder of extracted files, not one file —
so it renders as a plain <span>, not a link.
*/}}
{{ define "message_attachments" }}
<div class="msg-attachments">
{{ range . }}
{{ if .IsArchive }}
<span class="msg-attachment is-archive" title="{{ .Name }}">
<span class="msg-attachment-icon" aria-hidden="true">
<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/></svg>
</span>
<span class="msg-attachment-name">{{ .Name }} &middot; {{ .EntryCount }} file{{ if ne .EntryCount 1 }}s{{ end }}</span>
</span>
{{ else }}
<a class="msg-attachment" href="{{ .DownloadURL }}" download title="{{ .Name }}">
{{ if .IsImage }}
<img class="msg-attachment-thumb" src="{{ .DownloadURL }}" alt="{{ .Name }}" loading="lazy" />
{{ else }}
<span class="msg-attachment-icon" aria-hidden="true">
<svg viewBox="0 0 24 24" width="16" height="16" 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"/></svg>
</span>
{{ end }}
<span class="msg-attachment-name">{{ .Name }}</span>
</a>
{{ end }}
{{ end }}
</div>
{{ end }}