feat: UI/UX enhancement for model call failures (#1213)#1219
Open
eureka928 wants to merge 9 commits intoeigent-ai:mainfrom
Open
feat: UI/UX enhancement for model call failures (#1213)#1219eureka928 wants to merge 9 commits intoeigent-ai:mainfrom
eureka928 wants to merge 9 commits intoeigent-ai:mainfrom
Conversation
Create getToolkitIcon() that maps toolkit names to lucide-react icons by tool category (dev, browser, documents, media, communication, integrations) with a Wrench fallback for unknown toolkits.
Replace agent-type icons with per-toolkit icons using getToolkitIcon() so each tool action (Terminal, Browser, Note, etc.) is visually distinct.
Use normalize_error_to_openai_format() to classify ModelProcessingError and generic Exception errors, including error_code in SSE payloads so the frontend can take targeted action (e.g. invalid_api_key, model_not_found, insufficient_quota).
Lightweight endpoint to mark a provider as invalid without requiring the full provider payload, used by the frontend when an API key error is detected during a model call.
Add PATCH method support to proxyFetchRequest and expose proxyFetchPatch. Add optional error_code field to AgentMessage.data for typed error handling in the frontend.
Show contextual toast on model call failures with a link to Model Settings. Persistent (Infinity duration) for invalid_api_key errors, 8s for others.
Capture preferredProviderId during chat start. On SSE error events, show model error toast and call the invalidation endpoint when error_code is invalid_api_key.
Fix is_valid field mapping to read is_vaild (legacy typo) from the API response. Fix save payloads to send is_vaild: 2 (VaildStatus.is_valid). Update sidebar, BYOK detail, and default model dropdown to show red indicators for invalid providers and warning styling on the dropdown trigger. Show inline API key error when provider is invalidated.
Add chat keys for model error toast messages (invalid_api_key, model_not_found, insufficient_quota) and setting keys for API key invalid warning and default model unavailable labels across all 11 locales.
Contributor
Author
|
@Wendong-Fan @Pakchoioioi @4pmtong @bytecii would you review my PR? |
Contributor
Author
|
Hi @bytecii would you review my PR? |
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.
Description
Implements UI/UX improvements for model call failures to guide users toward fixing configuration issues, as described in #1213.
Backend:
error_code(invalid_api_key,model_not_found,insufficient_quota) using the existingnormalize_error_to_openai_format()classifierPATCH /provider/{id}/invalidateendpoint to mark a provider as invalid without sending full provider dataFrontend:
invalid_api_key, 8s for others)invalid_api_keyerrors, automatically call the invalidation endpoint to mark the provider invalid on the serveris_validfield mapping — the backend returnsis_vaild(legacy typo) but the frontend was readingis_valid, resulting in the green dot always being wrongis_vaild: 2(the correct field name and enum value)i18n:
Related Issue
Closes #1213
Changes Made
backend/app/service/chat_service.pyerror_codeserver/app/controller/provider/provider_controller.pyPATCH /provider/{id}/invalidatesrc/api/http.tsproxyFetchPatchhelper,PATCHmethod supportsrc/types/chatbox.d.tserror_codetoAgentMessage.datasrc/components/Toast/modelErrorToast.tsxsrc/store/chatStore.tssrc/pages/Setting/Models.tsxis_validmapping, update status dots, add warningssrc/i18n/locales/*/chat.jsonsrc/i18n/locales/*/setting.jsonWhat is the purpose of this pull request?