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

82 lines
2.9 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{{/*
The "Workspace files" sidebar panel: an upload form plus a listing of
every file currently in the agent's ENKLY_WORKSPACE, each linking to
GET /files/download/{path...}. Rendered three ways, all with the same
data shape (WorkspaceFiles, ConversationID, CSRFToken, UploadMessage,
UploadError — see indexData in pages.go and filesPanelData in
files.go):
1. Inline, as part of the full "index" page on first load.
2. Standalone, by GET /files — a manual "refresh the list" htmx
fragment (e.g. after the agent's own write_file tool created a
new file mid-conversation).
3. Standalone, by POST /files/upload — after saving what was
submitted, with UploadMessage/UploadError set.
Cases 2 and 3 both target and swap this element with
hx-swap="outerHTML", so the response IS the whole panel, including its
own wrapping <div id="workspace-files-panel">.
*/}}
{{ define "workspace_files_panel" }}
<!--<div class="sidebar-section workspace-section" id="workspace-files-panel">
<div class="sidebar-section-title">
<span>Workspace files</span>
<span class="files-title-right">
{{ len .WorkspaceFiles }}
<button
type="button"
class="icon-btn"
title="Refresh"
aria-label="Refresh workspace files"
hx-get="/files?conversation_id={{ .ConversationID }}"
hx-target="#workspace-files-panel"
hx-swap="outerHTML"
>⟳</button>
</span>
</div>
{{ if .UploadError }}<div class="upload-note upload-note-error">{{ .UploadError }}</div>{{ end }}
{{ if .UploadMessage }}<div class="upload-note upload-note-ok">{{ .UploadMessage }}</div>{{ end }}
<form
method="post"
action="/files/upload"
enctype="multipart/form-data"
class="upload-form"
hx-post="/files/upload"
hx-encoding="multipart/form-data"
hx-target="#workspace-files-panel"
hx-swap="outerHTML"
>
<input type="hidden" name="csrf_token" value="{{ .CSRFToken }}" />
<input type="hidden" name="conversation_id" value="{{ .ConversationID }}" />
<input
type="file"
name="files"
id="workspace-upload-input"
class="upload-input"
multiple
required
aria-label="Choose files to upload into the workspace"
/>
<button type="submit" class="upload-btn" title="Upload into the workspace">Upload</button>
</form>
<div class="file-list workspace-file-list">
{{ if .WorkspaceFiles }}
{{ range .WorkspaceFiles }}
<div class="file-item workspace-file-item">
<span class="file-icon">›</span>
<a href="{{ .DownloadURL }}" class="file-download-link" title="Download {{ .Path }}" download>{{ .Path }}</a>
<span class="file-size">{{ .SizeHuman }}</span>
</div>
{{ end }}
{{ else }}
<div class="file-item file-item-empty">
No files in the workspace yet. Upload one, or ask enkly to create one.
</div>
{{ end }}
</div>
</div>-->
{{ end }}