feat: persist chat history per user with sidebar navigation#298
Open
aizaz68 wants to merge 1 commit into
Open
Conversation
Fixes JoshuaC215#293 — adds a sidebar in the Streamlit UI that lists all past conversations for the current user, allowing them to resume any previous thread by clicking it. ## How it works A new `thread_registry` SQLite table maps every `user_id` (the persistent browser cookie that already existed in the app) to its thread IDs, along with a display title (the first user message) and timestamps. - On every new message, the service registers the thread_id + user_id in the registry so the record survives page refreshes and browser restarts. - A new `GET /threads?user_id=...` endpoint returns all threads for a user, newest first. - The Streamlit sidebar fetches this list on each render and displays clickable buttons — clicking one loads that conversation into the main chat view without losing the current thread. ## Files changed - `src/memory/thread_store.py` — new module: SQLite thread registry (CRUD) - `src/memory/__init__.py` — export thread store helpers; setup on startup - `src/schema/schema.py` — add `ThreadInfo` and `ThreadListResponse` models - `src/schema/__init__.py` — export new schema types - `src/service/service.py` — setup registry on startup; register/touch thread on every request; add `GET /threads` endpoint - `src/client/client.py` — add `get_threads()` method - `src/streamlit_app.py` — render chat history section in sidebar
JoshuaC215
pushed a commit
that referenced
this pull request
Jun 30, 2026
- #261: the contributor's real question in #259 (how to supply IndexConfig at the initialize_store() call site when it needs an embedding function, not an .env string) was never answered. Rewrote the draft to answer it: put model name + dims in settings, build IndexConfig inside initialize_store() (config-driven, off by default), with a snippet. - SKILL.md: add "answer the contributor's actual question first" pattern — check linked issues for an unanswered ask before jumping to test/lint. - #298, #303 marked Approved per Joshua. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ALYJSRixXCfLsmb2Koc1Hi
Owner
|
Hey @aizaz68 — thanks for tackling #293. Before going further on this one: it adds a separate Can we hash out the approach in #293 first? @surajvariar was also looking at this. I want to get the design right before merging ~200 lines across 7 files — happy to give feedback early. Thanks for the effort here! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #293 — adds a Chat History section to the Streamlit sidebar so users can see and resume past conversations.
How it works
The app already generates a persistent
user_id(stored in a browser cookie/URL param) but had no way to map it to previous thread IDs — they were lost the moment a new chat started.This PR introduces a lightweight
thread_registrySQLite table that records every(user_id, thread_id)pair as soon as the user sends their first message in a thread. The first message becomes the conversation title. The registry is separate from LangGraph's checkpointer and requires no schema changes to existing tables.Flow:
Files changed
src/memory/thread_store.pysrc/memory/__init__.pysetup_thread_registry()on startupsrc/schema/schema.pyThreadInfoandThreadListResponsePydantic modelssrc/schema/__init__.pysrc/service/service.pyGET /threadsendpointsrc/client/client.pyget_threads(user_id)methodsrc/streamlit_app.pyTest plan
user_idURL param — confirm history is shareduser_idsees only their own threads (user isolation)🤖 Generated with Claude Code