Enable model select when api fails #2217
Merged
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.
Bug: Cannot change model selection after API error due to UI state #1657
UI Bug: OpenRouter ran out of credits prevents user from switching models #1206
Context
Most users have probably experienced having to click "Retry" > "Cancel" when they've reached a rate limit. This fix allows you to quickly try a different provider.
I recognize that these bugs are labeled as "needs scope", but I'm sure there are plenty of users that would appreciate this fix while we determine the proper scope. (I've seen folks on both reddit and discord report this issue in addition to the issues noted above)
Implementation
I added selectApiConfigDisabled to ChatTextArea to separate the behavior from textAreaDisabled and enabled the model selector when clineAsk == "api_req_failed"
Screenshots
Before


After
How to Test
Reach an API rate limit and notice that the model selector is enabled. Notice that it is disabled in all other situations where textAreaDisabled
Important
Enable model selector in
ChatTextAreawhen API request fails, allowing users to switch models without retrying the failed request.ChatTextAreawhenclineAskis"api_req_failed", even iftextAreaDisabledis true.selectApiConfigDisabledprop added toChatTextAreato control model selector state independently.ChatTextArea.tsxto useselectApiConfigDisabledfor model selector.ChatView.tsxto setselectApiConfigDisabledbased onclineAskstate.ChatTextArea.test.tsxto verify model selector behavior withselectApiConfigDisabled.This description was created by
for 5c63bde. It will automatically update as commits are pushed.