feat(chat): save and view chat history — admin-only saved_chats, History page, open-a-chat return

This commit is contained in:
2026-08-29 21:22:25 -04:00
parent 6832957ab0
commit ece93a7c8f
29 changed files with 3099 additions and 20 deletions
+7 -5
View File
@@ -5,9 +5,10 @@ Two layers, one module:
* **Version token** (``asset_version()``) — the value the HTML pages
append to their asset URLs (``?v=<token>``).
* **Response middleware** (``CachingMiddleware`` / ``configure_caching``)
— applies the caching behavior at the transport layer: the five known
HTML pages are always revalidated (``no-cache``) and their local asset
references are rewritten to carry ``?v=<token>``; ``/assets/*`` is
— applies the caching behavior at the transport layer: the known
HTML pages (``HTML_PAGES``) are always revalidated (``no-cache``) and
their local asset references are rewritten to carry ``?v=<token>``;
``/assets/*`` is
served ``immutable`` for a year; everything else — all of ``/api/*``,
including the SSE chat stream — passes through byte-identical.
@@ -123,6 +124,7 @@ HTML_PAGES: tuple[str, ...] = (
"/login.html",
"/tuning.html",
"/git-sources.html", # phase 35: the admin git sources page
"/history.html", # phase 50: the admin saved-chats page
)
#: Prefix of the versioned static assets (header-only caching; the body is
@@ -192,8 +194,8 @@ class CachingMiddleware(BaseHTTPMiddleware):
* ``/assets/*`` — ``Cache-Control: public, max-age=31536000, immutable``
(header only — the body is never read).
* the five known HTML pages — ``Cache-Control: no-cache``, and (for
``text/html`` bodies) every local asset reference gains
* the known HTML pages (``HTML_PAGES``) — ``Cache-Control: no-cache``,
and (for ``text/html`` bodies) every local asset reference gains
``?v=<token>``.
Everything else — all of ``/api/*`` (including the SSE chat stream) —