feat: file/image upload + separated framework root (sessions/data/uploads)

- POST /api/uploads: base64 -> shared ~/.strata-ctl/uploads store (uuid+ext),
  content-sniffed kind (image/text/binary), text token-counted via the model
  tokenizer; metadata persisted in a new uploads table.
- Chat attachments routed by kind: images -> Vision bridge (multipart image_url),
  small text (<=2000 tokens) inlined, large text/binary -> path + shell_exec
  reminder; binaries never inlined. Attachment context persisted with the turn.
- GUI: attach button + file picker, removable chips, attachments sent with the
  turn and shown on the user bubble; cleared on session switch.
- Framework root ~/.strata-ctl separated by type: sessions/<name>/, data/ (SQLite,
  moved from ~/.config/strata-ctl), uploads/. Legacy DB copied once on first run.
- count_tokens seam on Formatter (real tokenizer override) + ChatService.
- i18n: upload errors + attachment markers (backend) and attach.* (GUI), it+en.
- 121 tests + 2 ignored; clippy/fmt clean; validated live (upload routing, real
  tokenizer count, image->Vision answered "Rosso", new layout).
This commit is contained in:
adm committed 2026-11-25 16:25:55 +01:00
1 parent 498e3dbc1b
commit 65f8111ba2
19 files changed
+672 -47

No files matched your search

+21
View File
@@ -177,6 +177,27 @@ details.thinking .reasoning {
}
#input:focus { outline: none; border-color: var(--accent); }
#send { min-width: 52px; font-size: 1.3rem; }
#attach { min-width: 44px; font-size: 1.2rem; }
/* ---- Attachment chips (composer + sent user turn) ---- */
.attachments {
display: flex; flex-wrap: wrap; gap: 6px;
padding: 8px 12px 0; background: var(--panel);
}
.attach-chip {
display: inline-flex; align-items: center; gap: 6px;
max-width: 240px; padding: 4px 8px;
background: var(--panel-2); border: 1px solid var(--border); border-radius: 999px;
font-size: 0.8rem; color: var(--text);
}
.attach-chip .attach-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-chip .attach-kind { color: var(--muted); }
.attach-chip button {
border: none; background: transparent; color: var(--muted);
cursor: pointer; font-size: 0.9rem; line-height: 1; padding: 0 2px;
}
.attach-chip button:hover { color: var(--danger); }
.msg-attachments { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
/* ---- Stats modal ---- */
#stats-modal, #dialog, #settings-modal {