Fix Chat Grounding Hover Citations
Summary
Fixed chat answers collapsing or losing text when final grounding citations were applied after streaming.
Root Cause
The backend was inserting markdown citation links at sentence boundaries. That could land inside bold text or decimal numbers, for example splitting **39 trades. 3.85** between 3. and 85**. When message_done replaced the streamed draft with the annotated final text, React Markdown re-parsed the message and left confusing gaps or broken formatting.
Changes
- Backend now attaches hidden grounding markers at line boundaries instead of inside sentences.
- Frontend now groups those hidden markers into hoverable paragraph/list text spans.
- Frontend strips visible or partial
[confidence: ...; sources: ...]fragments during streaming so they do not flash or leave residue. - Source/confidence details remain available in the hover tooltip and the sources panel, but are no longer visible at the end of sentences.
Files Updated
services/backend/src/routes/bots/bots-chat-handlers.tspackages/chat-ui/src/StreamingChatPanel.tsx
Validation
pnpm typecheckpassed.pnpm lintcompleted with existing warnings only and no errors.- Editor diagnostics show no errors in touched files.
- Sample check confirmed the marker is placed after the closing bold marker for the screenshot-style text.
Deployments
- Dev backend:
b4d05197-c592-4a31-9ccc-1c76af52e086 - Production backend:
b3985ece-e50f-4a30-af0c-1e2925ae31ef - Dev frontend Pages:
https://7ea5f28c.quantago-app.pages.dev(https://develop.quantago-app.pages.dev) - Production frontend Pages:
https://4dde7501.quantago-app.pages.dev
Health Checks
- Dev frontend: HTTP 200
- Production frontend: HTTP 200
- Dev API: HTTP 200
- Production API: HTTP 200