rony-chat-bot/internal
Victor Hugo Vargas 18e555e338 feat: persistent conversation storage (Phase 4)
Conversations survive page reloads and work for any frontend, not just
the widget. Server-side SQLite, conversation ID as bearer token, browser
identity via localStorage.

Backend
-------
- internal/portfolio/conversations.go: schema + CRUD. Conversations and
  messages tables in the same SQLite DB as the RAG index, with
  foreign-key cascade delete. Conv IDs are 16-byte random hex
  (128 bits of entropy).
- internal/portfolio/indexer.go: applies conversation schema + enables
  foreign_keys pragma in OpenStore.
- internal/server/handlers.go: POST /api/chat accepts an optional
  conversation_id, mints one if absent, persists user message before
  the LLM runs and assistant message (with sources) after the stream
  completes. New handlers: GetConversation, ListConversations,
  DeleteConversation.
- internal/server/server.go: routes for GET /api/conversations,
  GET/DELETE /api/conversations/{id}.
- internal/server/conversations_test.go: 6 tests (round-trip, continue,
  list, 404, delete, streaming).

Widget
------
- web/chat-widget.js: stores conv_id in localStorage["rony-chat-conv"],
  includes it in the chat request body, captures new IDs from the
  server's 'start' SSE event, and calls GET /api/conversations/{id} on
  load to restore history. On 404 it clears the stored ID and starts
  fresh.

Docs
----
- docs/architecture.md: §3.1 documents the conversation_id field and
  new REST endpoints; new §3.4 covers persistence lifecycle, schema,
  client responsibilities, and auth model. §5.6 updated; filetree
  reflects the new files.
- web/README.md: new 'Conversation persistence' section explains the
  browser-scoped behavior and how to opt out or persist across devices.
2026-07-17 00:56:35 -07:00
..
agent feat: bootstrap rony-chat-bot Go module 2026-07-17 00:56:06 -07:00
config feat: bootstrap rony-chat-bot Go module 2026-07-17 00:56:06 -07:00
i18n feat: bootstrap rony-chat-bot Go module 2026-07-17 00:56:06 -07:00
persona feat: bootstrap rony-chat-bot Go module 2026-07-17 00:56:06 -07:00
portfolio feat: persistent conversation storage (Phase 4) 2026-07-17 00:56:35 -07:00
server feat: persistent conversation storage (Phase 4) 2026-07-17 00:56:35 -07:00
streaming feat: bootstrap rony-chat-bot Go module 2026-07-17 00:56:06 -07:00