-
Notifications
You must be signed in to change notification settings - Fork 2.8k
fix: handle context window exceeded errors during context condensing #10783
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
When the selected condensing model has a smaller context window than the current conversation, the API throws an error that was previously unhandled. This caused the UI to hang with "Condensing Chat" forever. Changes: - Add try-catch around the streaming API call in summarizeConversation() - Detect context window exceeded errors and return user-friendly error message - Add new translation key for context window exceeded error - Add tests for error handling behavior Fixes #10781
Review complete. No issues found. The implementation correctly handles context window exceeded errors during context condensing by:
Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
|
This looks good to fix #10781 |
|
@roomote you are missing translations of the error message, see failed check-translations check: |
Fixed the missing translations. Added |
…ror message Added translations for errors.condense_context_window_exceeded to all 17 non-English locales: ca, de, es, fr, hi, id, it, ja, ko, nl, pl, pt-BR, ru, tr, vi, zh-CN, zh-TW
This PR attempts to address Issue #10781.
Problem
When the selected condensing model has a smaller context window than the current conversation, the API throws an error that was previously unhandled. This caused the UI to hang with "Condensing Chat" forever, giving no feedback to the user.
Solution
Added error handling around the streaming API call in
summarizeConversation()to:Changes
src/core/condense/index.ts: Added try-catch around the streaming API callsrc/i18n/locales/en/common.json: Added new translation keycondense_context_window_exceededsrc/core/condense/__tests__/index.spec.ts: Added 3 test cases for error handlingTesting
Feedback and guidance are welcome!
Important
Adds error handling for context window exceeded errors in
summarizeConversation()and updates translations and tests.summarizeConversation()to catch context window exceeded errors and return user-friendly messages.index.ts: Adds try-catch block around streaming API call insummarizeConversation().index.spec.ts: Adds test cases for context window exceeded and generic API error handling.common.json: Adds translation keycondense_context_window_exceededin multiple locales.This description was created by
for b819f1f. You can customize this summary. It will automatically update as commits are pushed.