- store: a swappable Store trait + bundled-SQLite implementation (WAL,
sessions/messages with per-turn token usage, cascade delete). The standard
/v1 API stays stateless; conversation context lives server-side so
multi-session, statistics and advanced settings can grow on top. DB path
configurable (db_path, default ~/.config/strata-ctl/sessions.db).
- api::sessions: session-aware GUI API — session CRUD, history, POST .../chat
(loads stored context, reuses the completion service, persists new turns with
usage; streaming accumulates the assistant turn and persists before [DONE]),
and /api/stats.
- api::web + web/: a mobile-first chat GUI (vanilla ES modules, no build step),
embedded via rust-embed and served at GET / (same-origin, offline, single
binary). Off-canvas session drawer on phones, persistent sidebar on wide
screens; live streaming with a collapsible thinking panel; model output is
inserted via textContent only.
- router_with_store mounts the GUI + session API only when a store is configured;
router()/router_with_auth() are unchanged (API-only).
- Fix: a global [hidden]{display:none!important} reset so an author display rule
(the stats modal's display:flex) cannot defeat the hidden attribute.
7 new tests (2 store unit + 4 session HTTP end-to-end + 1 config); 94 green +
2 ignored; clippy/fmt clean. Validated live on engine 0.1.67 (context retention,
streaming, stats) and via a browser check (modal, send/render, stats open/close).
Future: the Store backend is intended to move to ArangoDB (multi-model).
56 lines
1.8 KiB
HTML
56 lines
1.8 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="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="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="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>
|
|
|
|
<script type="module" src="/assets/app.js"></script>
|
|
</body>
|
|
</html> |