refactor: routing logic moved from frontend to backend#765
Merged
Avijit-Microsoft merged 3 commits intodevfrom Mar 12, 2026
Merged
refactor: routing logic moved from frontend to backend#765Avijit-Microsoft merged 3 commits intodevfrom
Avijit-Microsoft merged 3 commits intodevfrom
Conversation
Avijit-Microsoft
approved these changes
Mar 12, 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.
Purpose
This pull request refactors the frontend API layer and introduces a new backend routing service to centralize and standardize message intent detection and routing logic. The changes simplify the frontend API surface, unify message handling, and move previously frontend-based routing logic into a dedicated backend service. Additionally, the backend is now better equipped for intent-based message processing, and related tests have been updated accordingly.
Frontend API Refactor and Unification:
parseBrief,confirmBrief,selectProducts,streamChat, etc.) into a singlesendMessagefunction for sending messages/actions to the/api/chatendpoint, and introduced a unifiedMessageRequest/MessageResponsetype. This streamlines the frontend-backend communication and reduces duplicated logic. [1] [2]streamGenerateContentand content generation polling functions to use a singleGenerateRequestpayload, improving consistency and maintainability.pollTaskStatusfunction to poll for task completion (including image regeneration), replacing the previous streaming implementation for image regeneration.Backend Routing Service Introduction:
routing_service.pymodule that encapsulates message classification and intent detection logic. This service mirrors and replaces the routing previously done in the frontend and provides a clear, testable interface for determining user intent based on message content and conversation state.Test Updates:
/api/chatendpoint and to check for correct intent routing (e.g.,PARSE_BRIEFintent for title generation). Adjusted mocks and assertions to match the new backend logic and API surface. [1] [2] [3] [4]These changes collectively modernize the codebase by centralizing routing logic, simplifying the frontend API, and improving maintainability and testability.
Most important changes:
Frontend API Refactor:
sendMessagefunction and introducedMessageRequest/MessageResponsetypes, simplifying frontend-backend communication. [1] [2]GenerateRequestpayload and addedpollTaskStatusfor task polling. [1] [2]Backend Routing Service:
routing_service.py, a backend service for message intent classification and routing, moving logic from the frontend to the backend for better maintainability and testability.Test Adjustments:
/api/chatendpoint, reflecting the new routing and intent detection logic, and adjusted mocks accordingly. [1] [2] [3] [4]Does this introduce a breaking change?
Golden Path Validation
Deployment Validation