feat(chat): classify and surface generation errors inline - #1782
Conversation
|
@AnishSarkar22 is attempting to deploy a commit to the Rohan Verma's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Description
Motivation and Context
FIX #
Screenshots
API Changes
Change Type
Testing Performed
Checklist
High-level PR Summary
This PR improves error handling in the chat feature by introducing classified error types for LLM provider failures. On the backend, it adds an error classification system that maps HTTP failures to user-friendly messages with appropriate remediation actions (such as updating API keys or checking model availability). The frontend now displays contextual error notices with actionable buttons (Model setup or Retry) based on the error type. Additionally, the PR includes logic to discard incomplete chat turns when generation fails completely, preventing empty messages from persisting, and defers thread renaming until a successful reply is received. The changes include comprehensive test coverage for the new error handling behavior.
⏱️ Estimated Review Time: 15-30 minutes
💡 Review Order Suggestion
surfsense_local/backend/modules/chat/errors.pysurfsense_local/frontend/src/features/chat/sse.tssurfsense_local/frontend/src/features/chat/use-chat-runtime.tssurfsense_local/frontend/src/features/chat/chat-error-notice.tsxsurfsense_local/frontend/src/features/chat/message.tsxsurfsense_local/backend/modules/chat/router.pysurfsense_local/frontend/src/features/chat/thread-panel.tsxsurfsense_local/frontend/src/features/dashboard/dashboard-page.tsxsurfsense_local/frontend/src/components/ui/alert.tsxsurfsense_local/backend/tests/integration/chat/conftest.pysurfsense_local/backend/tests/integration/chat/test_chat.py