- Auto-title a session from its first user message (chat_title) so chats are distinguishable in the sidebar instead of all 'Nuova chat'. - Per-chat rename (✏️) and delete (🗑️) buttons with aria-labels; stopPropagation so they don't switch the conversation. deleteSessionById selects a fallback or creates a fresh session. - Replace native prompt()/confirm() with a styled custom modal (showDialog): mobile-friendly and inspectable by automation (native dialogs hung the browser subagent). Verified via direct HTTP (auto-title/rename/delete) + 108 tests; browser subagent avoided after repeated hangs.
72 lines
2.7 KiB
HTML
72 lines
2.7 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="it">
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
|
|
<meta name="color-scheme" content="dark light" />
|
|
<title>strata-ctl</title>
|
|
<link rel="icon" href="data:," />
|
|
<link rel="stylesheet" href="/assets/app.css" />
|
|
</head>
|
|
<body>
|
|
<div id="app">
|
|
<!-- Session drawer (off-canvas on mobile, sidebar on wide screens) -->
|
|
<aside id="drawer" aria-label="Sessioni">
|
|
<div class="drawer-head">
|
|
<span class="brand">strata‑ctl</span>
|
|
<button id="new-session" class="btn primary" title="Nuova conversazione">+ Nuova</button>
|
|
</div>
|
|
<ul id="session-list"></ul>
|
|
<div class="drawer-foot">
|
|
<button id="show-stats" class="btn ghost">Statistiche</button>
|
|
</div>
|
|
</aside>
|
|
<div id="splitter" role="separator" aria-orientation="vertical" aria-label="Ridimensiona l'elenco delle discussioni" aria-valuemin="200" aria-valuemax="480" aria-valuenow="280" tabindex="0"></div>
|
|
<div id="scrim" hidden></div>
|
|
|
|
<!-- Main column -->
|
|
<main id="main">
|
|
<header id="topbar">
|
|
<button id="menu" class="btn icon" aria-label="Apri sessioni">☰</button>
|
|
<div class="title-wrap">
|
|
<span id="session-title">Conversazione</span>
|
|
<span id="model-name" class="muted"></span>
|
|
</div>
|
|
<button id="delete-session" class="btn icon danger" aria-label="Elimina sessione">🗑</button>
|
|
</header>
|
|
|
|
<section id="transcript" aria-live="polite"></section>
|
|
|
|
<footer id="composer">
|
|
<textarea id="input" rows="1" placeholder="Scrivi un messaggio…" autocomplete="off"></textarea>
|
|
<button id="agent-toggle" class="btn ghost" aria-pressed="false" title="Modalità agent: il modello usa shell_exec sull'host">🤖</button>
|
|
<button id="send" class="btn primary" aria-label="Invia">➤</button>
|
|
</footer>
|
|
</main>
|
|
</div>
|
|
|
|
<!-- Stats modal -->
|
|
<div id="stats-modal" hidden>
|
|
<div class="modal-card">
|
|
<h2>Statistiche</h2>
|
|
<dl id="stats-body"></dl>
|
|
<button id="close-stats" class="btn">Chiudi</button>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Generic dialog (rename input / delete confirm); replaces native prompt/confirm -->
|
|
<div id="dialog" hidden>
|
|
<div class="modal-card">
|
|
<h2 id="dialog-title"></h2>
|
|
<p id="dialog-msg" class="muted"></p>
|
|
<input id="dialog-input" type="text" autocomplete="off" hidden />
|
|
<div class="dialog-actions">
|
|
<button id="dialog-cancel" class="btn">Annulla</button>
|
|
<button id="dialog-ok" class="btn primary">OK</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script type="module" src="/assets/app.js"></script>
|
|
</body>
|
|
</html> |