Skip to content

Feat/chat routing chain rewrite#6

Merged
sylvanding merged 6 commits intomainfrom
feat/chat-routing-chain-rewrite
Mar 12, 2026
Merged

Feat/chat routing chain rewrite#6
sylvanding merged 6 commits intomainfrom
feat/chat-routing-chain-rewrite

Conversation

@sylvanding
Copy link
Copy Markdown
Owner

No description provided.

… rewrite

Comprehensive planning documents for migrating chat message routing from
custom SSE + monolithic _stream_chat to Vercel AI SDK 5.0 Data Stream
Protocol + LangGraph StateGraph pipeline.

Made-with: Cursor
Backend: LangGraph StateGraph with 6 nodes (understand, retrieve, rank,
clean, generate, persist) emitting Data Stream Protocol events via
get_stream_writer(). New /stream/v2 endpoint runs alongside existing
/stream for gradual migration.

Frontend: Vercel AI SDK 5.0 useChat hook with custom transport,
OmeletteUIMessage types, useChatStream wrapper, and MessageBubbleV2
component rendering UIMessage.parts. PlaygroundPage rewritten to
eliminate manual SSE parsing and 15+ useState/useRef.

Made-with: Cursor
…dd pipeline tests

- Remove legacy _stream_chat and helpers (TOOL_MODE_PROMPTS, _clean_excerpt, etc.)
- Promote /stream/v2 to /stream as the sole chat endpoint
- Initialize LLM/RAG services at endpoint layer for proper config sharing
- Remove streamChat from frontend chat-api.ts (replaced by AI SDK transport)
- Update transport URL from /stream/v2 to /stream
- Add 23 tests: stream_writer formatting, ChatState types, graph compilation,
  config helpers, and 3 endpoint integration tests
- Simplify test_chat.py to only cover Conversation CRUD

Made-with: Cursor
Prevents React duplicate key warning when multiple thinking steps
share the same step name (e.g. two "understand" events).

Made-with: Cursor
Documents the full chat message routing chain rewrite: problem
symptoms, root cause, LangGraph + AI SDK 5.0 solution architecture,
5 implementation pitfalls encountered, and prevention strategies.

Made-with: Cursor
@sylvanding sylvanding merged commit 7f00ab1 into main Mar 12, 2026
2 of 4 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