feat: add Chat module with TanStack AI streaming and RAG#95
Merged
antosubash merged 6 commits intomainfrom Apr 8, 2026
Merged
Conversation
New user-facing Chat module layered on top of the Agents framework: conversations UI, multi-turn history, and automatic RAG augmentation via the existing agent pipeline. - Chat module (Contracts + impl + tests) with per-user conversations, permissions (Chat.View/Create/ManageAll), and IChatContracts for cross-module access - Streaming endpoint emits the @tanstack/ai SSE protocol (content/done/error chunks); Conversation.tsx uses useChat via fetchServerSentEvents - Graceful mid-stream error handling: LLM failures surface as TanStack error chunks and partial replies are still persisted - Framework: AgentChatRequest gains optional History; PrepareAgentCallAsync replays prior turns so multi-turn conversations have context - Shared test factory registers ChatDbContext - 74 tests (unit + HTTP integration + streaming wire-format)
Deploying simplemodule-website with
|
| Latest commit: |
16c1a8a
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://e1702273.simplemodule-website.pages.dev |
| Branch Preview URL: | https://feature-modest-dhawan.simplemodule-website.pages.dev |
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.
Summary
New user-facing Chat module layered on top of the existing Agents framework — conversations UI, multi-turn history, automatic RAG augmentation, and streaming replies over the @tanstack/ai SSE protocol.
modules/Chat): Contracts + impl + DbContext with per-userConversation/ChatMessagepersistence,IChatContractsfor cross-module use,ChatPermissions(View/Create/ManageAll), seven REST endpoints for CRUD + message history, one SSE streaming endpoint./api/chat/conversations/{id}/streamendpoint emits TanStackcontent/done/errorchunks. Mid-stream LLM failures are delivered aserrorframes and any partial assistant text is still persisted.Pages/Conversation.tsx): usesuseChatfrom@tanstack/ai-reactwithfetchServerSentEvents; seedsinitialMessagesfrom server props.Pages/Browse.tsxlists conversations and creates new ones via an agent picker.framework/SimpleModule.Agents):AgentChatRequestgains an optionalHistorycollection;PrepareAgentCallAsyncreplays prior turns so multi-turn conversations have context. Backwards-compatible (defaultnull) — existing Agents-module callers unaffected.tests/SimpleModule.Tests.Shared): registersChatDbContextso integration tests can hit the Chat module through the real HTTP pipeline.Test plan
dotnet build template/SimpleModule.Host— 0 errors (source generator discovers[Module("Chat")], no SM00xx diagnostics)dotnet test modules/Chat/tests/SimpleModule.Chat.Tests— 74 tests passingChatServiceTests(29),TanStackDtoSerializationTests(6),ConversationIdTests+ChatMessageIdTests(7),AgentHistoryReplayTests(5 — proves framework history replay with a fakeIChatClient)ChatEndpointTests(17 — CRUD over HTTP, auth, permission, multi-user isolation),ChatStreamingEndpointTests(10 — SSE wire format parsing, persistence, history forwarding, error frames)dotnet test modules/Products/tests/SimpleModule.Products.Tests— 39/39 still passing (sanity-check the shared-factory edits)dotnet run --project template/SimpleModule.Host, navigate to/chat, pick an agent, send a message and confirm the response streams token-by-tokenEnableRag/RagCollectionName)Notes
routes.tsregeneration is the only auto-generated churn in the diff.@tanstack/ai-react/@tanstack/ai-clientare declared as^0.1.0inmodules/Chat/src/SimpleModule.Chat/package.json— pin to the latest real version during review if needed.