Stream assistant answers token-by-token; mobile drawer + conversation pagination #39

Merged
ryan merged 1 commits from mobile-drawer-conversation-pagination into main 2026-09-09 23:15:14 -04:00
Owner

Summary

Two changes on this branch:

Token-by-token answer streaming

The /stream-query SSE endpoint previously emitted only tool-lifecycle events plus one final complete message, so the assistant's answer still appeared all at once. Now it handles on_chat_model_stream events and emits incremental content deltas.

  • Backend (blueprints/conversation/__init__.py): new content SSE event from on_chat_model_stream, accumulated server-side as a persistence fallback for the final message.
  • Frontend (useChat.ts, conversationService.ts): consume content deltas to build a live assistant bubble, reconciled with the authoritative persisted text on the terminal response event. New streaming flag hides the redundant loading indicator once tokens start (ChatScreen.tsx).
  • Legacy non-streaming /query endpoint left intact for compatibility.

Mobile drawer + conversation pagination

Replaces the inline mobile menu with a slide-in drawer and paginates the conversation list.

Testing

  • Backend: 74 passed (.venv/bin/python -m pytest tests/)
  • Frontend: yarn build + tsc --noEmit clean

🤖 Generated with Claude Code

## Summary Two changes on this branch: ### Token-by-token answer streaming The `/stream-query` SSE endpoint previously emitted only tool-lifecycle events plus one final complete message, so the assistant's answer still appeared all at once. Now it handles `on_chat_model_stream` events and emits incremental `content` deltas. - **Backend** (`blueprints/conversation/__init__.py`): new `content` SSE event from `on_chat_model_stream`, accumulated server-side as a persistence fallback for the final message. - **Frontend** (`useChat.ts`, `conversationService.ts`): consume `content` deltas to build a live assistant bubble, reconciled with the authoritative persisted text on the terminal `response` event. New `streaming` flag hides the redundant loading indicator once tokens start (`ChatScreen.tsx`). - Legacy non-streaming `/query` endpoint left intact for compatibility. ### Mobile drawer + conversation pagination Replaces the inline mobile menu with a slide-in drawer and paginates the conversation list. ## Testing - Backend: 74 passed (`.venv/bin/python -m pytest tests/`) - Frontend: `yarn build` + `tsc --noEmit` clean 🤖 Generated with [Claude Code](https://claude.com/claude-code)
ryan added 1 commit 2026-09-09 23:14:57 -04:00
The /stream-query endpoint previously emitted only tool-lifecycle events plus
one final complete message, so the answer still appeared all at once. Handle
on_chat_model_stream events to emit incremental `content` deltas, accumulate
them for persistence fallback, and consume them on the frontend to build a live
assistant bubble (reconciled with the authoritative final text). Hide the
redundant loading indicator once tokens start arriving.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
ryan merged commit 53f76f58ea into main 2026-09-09 23:15:14 -04:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ryan/simbarag#39