Add chat sources and citations

This commit is contained in:
Matthias
2026-06-16 10:58:15 +02:00
parent 85af9d7078
commit 9f17d4d1e1
9 changed files with 356 additions and 13 deletions

View File

@@ -4,7 +4,7 @@ title: Modernize savings chat agent UI with AI Elements phases
status: In Progress
assignee: []
created_date: '2026-06-16 08:38'
updated_date: '2026-06-16 08:46'
updated_date: '2026-06-16 08:57'
labels: []
dependencies: []
priority: high
@@ -21,8 +21,8 @@ Implement the planned AI Elements-inspired savings chat agent UI in three sequen
<!-- AC:BEGIN -->
- [x] #1 Phase 1 replaces the basic chat surface with reusable conversation, message, prompt input, and tool trace UI primitives
- [x] #2 Phase 2 adds a safe reasoning/work-progress disclosure derived from existing tool traces, without exposing hidden chain-of-thought
- [ ] #3 Phase 3 adds structured source/citation support through stored assistant metadata and visible UI affordances
- [ ] #4 Each phase is covered by failing-first tests, verified after implementation, and committed separately
- [x] #3 Phase 3 adds structured source/citation support through stored assistant metadata and visible UI affordances
- [x] #4 Each phase is covered by failing-first tests, verified after implementation, and committed separately
<!-- AC:END -->
## Implementation Plan
@@ -43,4 +43,8 @@ Implement the planned AI Elements-inspired savings chat agent UI in three sequen
Phase 1 complete: added AgentChat primitives for conversation, message rendering, prompt input, and tool trace disclosure; integrated SavingsChatPage. Verification: npx vitest src/components/chat/AgentChat.test.tsx --run, npx eslint targeted chat/page files, npm run build (Vite chunk-size warning only).
Phase 2 complete locally: added safe work-progress/reasoning disclosure derived from toolTrace result summaries, removed raw inputSummary display from the disclosure, and added active progress state while a response is pending. Verification: npx vitest src/components/chat/AgentChat.test.tsx --run (9 tests), targeted eslint, npm run build (Vite chunk-size warning only). Spec subagent review approved.
Phase 3 complete locally: added optional sources/citations metadata to chat messages, preserved it through import/list/append history flows, generated private finance sources from executed tool traces in savings chat responses, and rendered source lists plus inline citation markers in AgentChat. Verification: npx vitest src/components/chat/AgentChat.test.tsx convex/savingsChat.test.ts --run (37 tests), targeted eslint, npm run build (Vite chunk-size warning only).
Phase 3 review follow-up: addressed spec blocker by generating citation metadata from tool-derived sources and appending visible citation markers to live ask/sendMessage answers. Re-verified: npx vitest src/components/chat/AgentChat.test.tsx convex/savingsChat.test.ts --run (37 tests), targeted eslint, npm run build. Spec re-review approved.
<!-- SECTION:NOTES:END -->