feat(public-chat): chat history dropdown for logged-in users (#587) - #588
Merged
Conversation
Logged-in Trinity users visiting a public agent link can now browse
and view their previous chat sessions with that agent via a dropdown
in the header. Sessions are read-only to avoid false continuity with
the live agent context window.
- GET /api/public/sessions/{token} — list caller's sessions (JWT req'd)
- GET /api/public/sessions/{token}/{session_id} — session detail
- ChatHistoryDropdown.vue — new component, click-outside aware
- Read-only banner + "Return to current chat" in PublicChat.vue
- Anonymous sessions excluded (no user_id in db)
Fixes #587
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
Changes
Backend (
src/backend/routers/public.py):GET /api/public/sessions/{token}— JWT-authenticated; returns caller's sessions for the agent behind this public link (bypassesget_authorized_agentwhich would 403 non-owner visitors)GET /api/public/sessions/{token}/{session_id}— JWT-authenticated; session detail with ownership validationFrontend:
src/frontend/src/components/chat/ChatHistoryDropdown.vue— new dropdown component (click-outside aware, date formatting, error/loading/empty states)src/frontend/src/views/PublicChat.vue— importsuseAuthStore, shows dropdown for authenticated users, read-only mode with bannerTests (
tests/test_public_chat_history.py): auth requirements, 404 on invalid tokens, limit param validationTest Plan
pytest tests/test_public_chat_history.py -v(5 pass, 1 expected skip)Fixes #587
🤖 Generated with Claude Code