feat(chat): ChatService facade — unified chat CRUD + LLM generation (#645)#658
Merged
feat(chat): ChatService facade — unified chat CRUD + LLM generation (#645)#658
Conversation
…645) Implement ChatServiceImpl in modules/chat/facade.py that wraps existing ChatService (CRUD) + ChatShareService with send_message() and stream_message() methods, implementing the ChatService Protocol from protocols.py. Refactored router to delegate LLM generation to the facade instead of inline code. Removed ~500 lines of duplicated agentic RAG loop, prompt assembly, and RAG injection from three router endpoints (send, stream, edit, regenerate). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
shikhalev
approved these changes
Mar 31, 2026
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
ChatServiceImplinmodules/chat/facade.py— implementsChatServiceProtocol, wraps existing CRUD + sharing services, addssend_message()andstream_message()methods with full agentic RAG loop supportStreamChunkschema withtypefield and event-specific fields (message,name,query,found) to support all SSE event typesServiceContainerandorchestrator.pystartup (Phase 7.4)Architecture
Router retains HTTP concerns (auth, rate limiting, LLM backend resolution, image uploads, RAG config resolution). Facade owns the core flow: prompt assembly → RAG injection → context trimming → agentic tool loop → save response.
Closes #645
Test plan
ruff check)from modules.chat.facade import ChatServiceImpl)🤖 Generated with Claude Code