Skip to content

feat(public-chat): chat history dropdown for logged-in users (#587) - #588

Merged
vybe merged 1 commit into
devfrom
feature/587-public-chat-history
Apr 29, 2026
Merged

feat(public-chat): chat history dropdown for logged-in users (#587)#588
vybe merged 1 commit into
devfrom
feature/587-public-chat-history

Conversation

@vybe

@vybe vybe commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Logged-in Trinity users visiting a public agent link now see a History dropdown in the header listing their previous chat sessions with that agent (last 20, most-recent first)
  • Past sessions load in read-only mode with an amber banner and "Return to current chat" — no false continuity with the live agent context window
  • Not-logged-in users: no change to existing UI

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 (bypasses get_authorized_agent which would 403 non-owner visitors)
  • GET /api/public/sessions/{token}/{session_id} — JWT-authenticated; session detail with ownership validation

Frontend:

  • 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 — imports useAuthStore, shows dropdown for authenticated users, read-only mode with banner

Tests (tests/test_public_chat_history.py): auth requirements, 404 on invalid tokens, limit param validation

Test Plan

  • Tests pass: pytest tests/test_public_chat_history.py -v (5 pass, 1 expected skip)
  • Not logged in: History button absent, no visible change
  • Logged in, no sessions: History dropdown shows "No previous sessions found"
  • Logged in, sessions exist: dropdown lists sessions with date/count/preview
  • Click session: messages load, amber read-only banner shows, input hidden
  • "Return to current chat": exits read-only, reloads live session

Fixes #587

🤖 Generated with Claude Code

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>
@vybe
vybe merged commit 85dfe14 into dev Apr 29, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant