Skip to content

Chunk citation UX: AI descriptions, hash navigation, highlight animation#32

Merged
suguanYang merged 9 commits into
stagingfrom
feat/wangbinqi/chunk-citation-ux-staging
May 10, 2026
Merged

Chunk citation UX: AI descriptions, hash navigation, highlight animation#32
suguanYang merged 9 commits into
stagingfrom
feat/wangbinqi/chunk-citation-ux-staging

Conversation

@suguanYang
Copy link
Copy Markdown
Contributor

Implements citation UX improvements per @suguan's requirements. Based on staging (not notebook-mvp).

Changes

  1. AI citation descriptions — updated chat prompt requests descriptive citation labels. description field on ChatCitationView.
  2. Hash-based URI chunk navigationuseHashFragment hook writes #chunk-{id} to the URL. Integrated into the existing requestChunkFocus callback so all focus paths (citation clicks, connection clicks) push to the hash. Browser back/forward works. Deep-linking works.
  3. Citation highlight animation — CSS @keyframes citation-pulse with citation-card-highlight class.

Not changed

  • Pi's existing virtualizer setup (@tanstack/react-virtual) is untouched
  • ChunksPanel scroll mechanism is unchanged
  • No new dependencies added beyond what staging already has

Verified

  • pnpm build: clean
  • pnpm test: 151 pass, 12 skip

Signed-off-by: suguanyang wangbinqi77@gmail.com

…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>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 10, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
knowhere-notebook Error Error May 10, 2026 6:17pm
knowhere-notebook-staging Ready Ready Preview, Comment May 10, 2026 6:17pm

Request Review

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>
@suguanYang suguanYang merged commit bcbd301 into staging May 10, 2026
2 of 3 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