Chunk citation UX: AI descriptions, hash navigation, highlight animation#32
Merged
Merged
Conversation
…ht pulse Built on top of staging (not notebook-mvp per @suguan). Only adds citation-specific changes without touching the existing virtualizer. ### 1. AI citation descriptions - Chat prompt updated to request descriptive citation labels. - `description` field added to ChatCitationView. - Citation chips prefer description over bare filename. ### 2. Hash-based chunk navigation - New useHashFragment hook: #chunk-{id} in URL, SPA-native. - workspace-shell now reads/writes the hash instead of useState. ### 3. Citation highlight animation - CSS keyframes citation-pulse, applied via citation-card-highlight. Verified: pnpm build clean, pnpm test 160+ pass / 12 skip. Signed-off-by: suguanyang <wangbinqi77@gmail.com>
Adds useHashFragment alongside the existing requestChunkFocus so
citation clicks, connection clicks, and other focus paths all push
to #chunk-{id} in the URL. Hash changes on mount trigger focus.
Does not touch Pi's virtualizer or chunk management.
Signed-off-by: suguanyang <wangbinqi77@gmail.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Replaces the instant scrollToOffset(0) with a two-pass approach: auto-scroll first, then smooth-scroll in the next frame. Keeps getChunksWithFocusedFirst ordering intact (cited chunk first, then document order below). Fixed 3 test assertions that broke on smooth-scroll in jsdom. Signed-off-by: suguanyang <wangbinqi77@gmail.com>
Guest demo mode now shows 6 pre-built messages (3 user questions + 3 AI answers with citations) referencing the TSLA-Q4-2025 demo source. Clicking a citation chip triggers the same citation flow as authenticated mode — the source is loaded from public demo assets and the content panel scrolls to the referenced section. This lets anyone test the citation→chunk navigation flow without logging in. Signed-off-by: suguanyang <wangbinqi77@gmail.com>
handleDemoCitationClick now fetches demo chunks from
/demo-sources/{assetDir}/chunks.json instead of the API endpoint
(which 404s for demo sources). Matches by sectionPath first,
then content prefix, then first available chunk.
Signed-off-by: suguanyang <wangbinqi77@gmail.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.
Implements citation UX improvements per @suguan's requirements. Based on staging (not notebook-mvp).
Changes
descriptionfield on ChatCitationView.useHashFragmenthook writes#chunk-{id}to the URL. Integrated into the existingrequestChunkFocuscallback so all focus paths (citation clicks, connection clicks) push to the hash. Browser back/forward works. Deep-linking works.@keyframes citation-pulsewithcitation-card-highlightclass.Not changed
@tanstack/react-virtual) is untouchedVerified
Signed-off-by: suguanyang wangbinqi77@gmail.com