feat(chat): rich citation cards, excerpt rewrite, inline annotations, and A2UI rendering#4
Merged
sylvanding merged 8 commits intomainfrom Mar 12, 2026
Merged
Conversation
…ream throttling Phase 1 of knowledge base retrieval enhancement: - Backend: batch Paper query for citation metadata (authors/year/doi/chunk_type) - Frontend: CitationCard with collapsible excerpts, relevance badges, DOI links - CitationCardList with stagger animations and show-more pagination - MessageLoadingStages: searching → citations → generating → complete - Stream throttling: text_delta batched at 80ms intervals to reduce Markdown re-parses - Type safety: isCitation guard + normalizeCitation for snippet→excerpt compat - Version bump to v0.2.0 Made-with: Cursor
…selector Phase 2: adds POST /api/v1/chat/rewrite endpoint with 5 rewrite styles (simplify, academic, translate_en, translate_zh, custom), Pydantic validation, semaphore-based rate limiting, and 30s timeout. Frontend adds RewritePanel with react-diff-viewer-continued for original vs rewritten comparison, RewriteStyleSelector with preset and custom options, and activates the rewrite button on CitationCard. Made-with: Cursor
…d linking Phase 3: adds remark-citation plugin to transform [N] patterns into interactive colored tags in AI responses. InlineCitationTag renders with citation color, HoverCard preview (title, authors, excerpt), and click-to-scroll linking. CitationCardList gains highlight flash animation on targeted scroll. Supports out-of-range graceful fallback and progressive activation during streaming. Made-with: Cursor
Phase 4: integrates @a2ui-sdk/react v0.8 with 3 custom Omelette components (CitationCard, RewriteDiff, StatsDashboard). Backend multi-KB retrieval parallelized with asyncio.gather() for significant latency reduction. Frontend handles a2ui_surface SSE events with automatic fallback for invalid messages. ConnectRPC deferred to future iteration due to connect-python Alpha status. Made-with: Cursor
Made-with: Cursor
…ad link - Move onAction from A2UIProvider to A2UIRenderer (matches SDK API) - Inline A2UIComponentProps type (not exported from @a2ui-sdk/react/0.8) - Cast citation-ref custom component to bypass react-markdown Components type - Fix useRef<ReturnType<typeof setTimeout>> requiring initial value - Rename snippet to excerpt in MessageBubble test fixture - Prefix unused ocrMutation with underscore - Fix relative link path in plan document for VitePress Made-with: Cursor
…crMutation - Cast custom A2UI components to CatalogComponent (runtime props injected by framework) - Remove unused ocrMutation and ocrApi import from PapersPage Made-with: Cursor
…ge mock provider - Add aria-label to ChatInput submit button for accessibility - Use specific button name selector in ChatInput tests (attach vs send) - Fix SettingsPage test: verify test-connection hidden for mock provider Made-with: Cursor
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
Complete implementation of the Rich Citation & Rewrite Enhancement feature across 4 phases, transforming the chat playground into a powerful scientific literature interaction experience.
Phase 1: Rich Citation Cards + Loading Animation
Phase 2: Excerpt Rewrite + Diff Comparison
POST /api/v1/chat/rewriteSSE streaming endpoint with 5 styles (simplify, academic, translate_en, translate_zh, custom)asyncio.Semaphore(3)rate limiting + 30s timeoutreact-diff-viewer-continuedfor original vs rewritten comparisonPhase 3: Inline Citation Tags + Cross-referencing
remark-citationplugin transforms[N]patterns into interactive colored tagsInlineCitationTagwith Radix HoverCard for paper preview (title, authors, excerpt)Phase 4: A2UI Rich Media + Parallel Retrieval
@a2ui-sdk/reactv0.8 integration with 3 custom Omelette components (CitationCard, RewriteDiff, StatsDashboard)a2ui_surfaceSSE event handling with automatic fallback for invalid messagesasyncio.gather()(significant latency reduction)connect-pythonAlpha statusNew Dependencies
react-diff-viewer-continued,@radix-ui/react-hover-card,@a2ui-sdk/react,@a2ui-sdk/types,unist-util-visitFiles Changed (29 files, +4972/-96)
rewrite.py(new),chat.py(parallel RAG),__init__.py(router)Testing
Post-Deploy Monitoring & Validation
[LLM:*]rewrite task entries, SSEa2ui_surfaceevent emissioncurl -X POST /api/v1/chat/rewritewith sample excerptrewrite_endevent; parallel RAG queries complete faster than sequentialasyncio.Semaphoreexhaustion (>3 concurrent rewrites), A2UI JSON parse errors in frontend consoleVersion