Skip to content

PR-C (N-002/N-003): source upload and status list#5

Merged
suguanYang merged 3 commits into
feat/wangbinqi/notebook-mvpfrom
feat/wangbinqi/n-002-upload
May 7, 2026
Merged

PR-C (N-002/N-003): source upload and status list#5
suguanYang merged 3 commits into
feat/wangbinqi/notebook-mvpfrom
feat/wangbinqi/n-002-upload

Conversation

@suguanYang
Copy link
Copy Markdown
Contributor

Implements requirements cards N-002 Source intake and upload handoff and N-003 Source list and parse status against the MVP integration branch.

Summary

  • Adds server action upload flow for local files.
  • Validates supported file types and 25 MB limit before Knowhere handoff.
  • Writes uploads to a temp directory, uploads that temp file to Knowhere, then always removes the temp directory.
  • Persists only source metadata/status/job/document ids in Postgres; no raw file blobs and no chunk copies.
  • Adds /api/sources polling endpoint that reconciles parsing jobs through Knowhere jobs.get and returns source sidebar view data.
  • Wires the Sources sidebar to real server data and upload action.
  • Adds on-demand ready-source section counts via Knowhere documents.listChunks(... pageSize: 1); count is view data only, not persisted.

Verification

  • pnpm lint
  • pnpm test — 33 passed, 10 integration skipped without env
  • TEST_DATABASE_URL=postgres://postgres:postgres@127.0.0.1:55432/knowhere_notebook_e2e pnpm test:integration — 10 passed
  • DATABASE_DRIVER=pg DATABASE_URL=postgres://postgres:postgres@localhost:55432/knowhere_notebook_e2e pnpm db:push — no schema changes
  • DATABASE_DRIVER=pg DATABASE_URL=postgres://postgres:postgres@localhost:55432/knowhere_notebook_e2e DASHBOARD_SESSION_URL=http://dashboard.127.0.0.1.nip.io:3000/api/orpc/users/getCurrentUser DASHBOARD_LOGIN_URL=http://dashboard.127.0.0.1.nip.io:3000/login NOTEBOOK_PUBLIC_URL=http://notebook.127.0.0.1.nip.io:3001 pnpm build

Notes

  • This PR intentionally does not implement the parsed content viewer; that is PR-D / N-004.
  • This PR intentionally does not implement chat/retrieval; that is PR-E / N-005.
  • Upload action returns after Knowhere handoff and marks the row parsing; /api/sources polling reconciles to ready or failed.

@suguanYang
Copy link
Copy Markdown
Contributor Author

PR-C staging upload verification update:

  • Added env-driven KNOWHERE_BASE_URL support so staging/prod API endpoints are configurable.
  • Added a unit regression for SDK construction with baseURL.
  • Verified staging with local-only secrets: direct SDK create/upload succeeded, then browser upload through Notebook reached ready and showed Processed · 1 sections.
  • Cleaned smoke artifacts: soft-deleted the local source row, removed the temp fixture, and archived the two staging documents created during direct + browser smoke.

Checks passed after the change:

  • pnpm lint
  • pnpm test
  • pnpm test:integration
  • DATABASE_DRIVER=pg DATABASE_URL=... KNOWHERE_BASE_URL=https://api-staging.knowhereto.ai pnpm build

Commit: 586e9f6

@suguanYang suguanYang merged commit b912ea4 into feat/wangbinqi/notebook-mvp May 7, 2026
@suguanYang suguanYang mentioned this pull request May 7, 2026
suguanYang added a commit that referenced this pull request May 8, 2026
### Chunk list scrolling
The @base-ui/react ScrollArea Root didn't enforce `overflow-hidden` or
`min-h-0`, so when the ChunksPanel's ScrollArea received `flex-1`, the
flex layout could not constrain its height. The viewport then grew to
fit all children and the parent page scrolled instead of the panel.

Fix: add `overflow-hidden` and `min-h-0` to the ScrollArea Root so
flex-1 creates a scroll containment context. Both ChunksPanel and
ChatPanel use the same component so this is a single-point fix.

### Optimistic chat message rendering
Previously `handleChatSend` waited for the `/api/chat` roundtrip before
appending any message, so the UI felt frozen while the assistant
responded. Fix per @suguan's UX report:

1. Append a `{ id: "pending-{ts}", role: "user", content: text }`
   message to the local state immediately on send.
2. The composer shows `isSending` while the request is in flight.
3. When the server succeeds, filter the response to assistant-role
   only, remove the optimistic id, and append the real assistant
   message. No duplicate user message.
4. On failure, keep the optimistic user message visible alongside the
   error toast (the user's question is not lost).

Acceptance criteria from @pi's NB-MOB-002:
- User message appears immediately before the assistant response
- Composer indicates sending and prevents duplicate submit
- Assistant message is appended without duplicating the user turn
- Error state keeps the submitted question visible

### Verified
pnpm build: clean
pnpm test: 69 pass, 12 skip

Signed-off-by: suguanyang <wangbinqi77@gmail.com>
suguanYang added a commit that referenced this pull request May 8, 2026
…stic-chat

Fix chunk scrolling and optimistic chat message rendering (task #5)
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