From 6d2d9b897e7d9758e0d27ffcd2bf21154d809806 Mon Sep 17 00:00:00 2001 From: Anais Saraiva Date: Mon, 21 Sep 2026 17:20:08 +0200 Subject: [PATCH] . --- README.md | 4 +- docs/ARCHITECTURE.md | 9 ++-- docs/FRONTEND.md | 11 +++-- frontend/src/lib/i18n.ts | 90 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 105 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index b1110f6..19c5498 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,8 @@ from the **Accounts** panel (each gets a one-time access key to hand over). | POST | `/api/auth/totp` | challenge | second login step `{totpToken, code}` → session | | GET/PATCH/DELETE | `/api/conversations/:id` | owner | incl. messages on GET | | POST/GET/DELETE | `/api/conversations/:id/share` | owner | public link `/share/:publicId` | +| GET | `/api/conversations/archived` | Bearer | archived chats (hidden from sidebar + search) | +| POST | `/api/conversations/:id/archive`, `/api/conversations/:id/unarchive` | owner | archive (read-only) / restore to the list | | GET | `/api/share/:publicId` | **public** | read-only shared chat JSON | | GET | `/api/models` | Bearer | `[{id: "driver:model", …}]` across enabled drivers | | POST | `/api/chat` | Bearer | `{model, messages, conversationId?, stream?}` → JSON or SSE | @@ -84,7 +86,7 @@ reply into that conversation (ownership enforced) and auto-titles new chats. `$DATA_DIR/kisassistant.db` (WAL mode). Tables: `users` (id, username, display_name, avatar_url, theme, email, key_hash), `sessions` (hashed Bearer tokens), -`conversations` (id, user, title, topic, model), `messages`, `shares`, +`conversations` (id, user, title, topic, model, archived_at), `messages`, `shares`, `resets` (recovery tokens), `settings` (feature flags) (conv ↔ public id). No migration system — schema is created idempotently at boot. diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index 8adfbc0..9d405b9 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -22,9 +22,10 @@ browser ──► Bun.serve (src/index.ts) are auto-titled from it. 4. Non-streaming → `driver.chat()` → JSON. Streaming → `driver.chatStream()` → SSE events `token` / `done` / `error`. The full reply is persisted after a - successful stream; on error the partial text is kept as-is (no internal - markers). Server logs each stream open/done/abort per driver when - `DRIVER_DEBUG=true`. + successful stream; on error the partial text is kept as-is (no internal + markers). Server logs each stream open/done/abort per driver when + `DRIVER_DEBUG=true`. `POST /api/chat` with an archived `conversationId` + is rejected (403) — archived chats are read-only. Streaming guarantees (ChatGPT-style, no buffering): @@ -47,7 +48,7 @@ Created idempotently at boot in `getDb()` (no migration framework; keep it so). | `sessions` | `token_hash PK, user_id, created_at, expires_at`. Bearer tokens, 256-bit, hashed with sha256. Expired rows are purged lazily on access. | | `resets` | `token_hash PK, user_id, created_at, expires_at`. One-time key-recovery tokens (single use, consumed on POST). | | `settings` | `key PK, value, updated_at`. Admin-controlled feature flags (`registration_enabled` default off, `tools_ocr_enabled` default on). | -| `conversations` | `id, user_id, title, topic, model, created_at, updated_at`. | +| `conversations` | `id, user_id, title, topic, model, archived_at, created_at, updated_at`. `archived_at = 0` means live; otherwise a unix-ms archive timestamp (added idempotently via `ALTER TABLE`, like `users.email`). | | `messages` | `id AUTOINCREMENT, conv_id → conversations ON DELETE CASCADE, role, content, created_at`. | | `shares` | `conv_id PK → conversations ON DELETE CASCADE, public_id UNIQUE, created_at`. | diff --git a/docs/FRONTEND.md b/docs/FRONTEND.md index 5e7d51d..05728bb 100644 --- a/docs/FRONTEND.md +++ b/docs/FRONTEND.md @@ -35,15 +35,18 @@ read-only `SharePage` (no auth), everything else renders the authenticated app. **Never use a native `