fix: prevent model selection failures when API requests fail (fixes #3813, #3874) #3899
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.
fix: prevent model selection failures when API requests fail (fixes #3813, fixes #3874)
This PR addresses issues #3813 and #3874 where users were unable to select models in the settings interface when certain provider APIs failed.
Changes:
Technical details:
The previous implementation used Promise.all which would fail entirely if any single provider API request failed. By switching to Promise.allSettled, we now properly handle partial failures and allow users to select from available models even when some providers are unreachable or return errors. Additionally, the initialization logic in ModelPicker has been fixed to properly handle the default model selection.
Important
Switch to
Promise.allSettledfor API requests and fix default model selection inModelPickerto handle failures gracefully.Promise.allwithPromise.allSettledinwebviewMessageHandler.tsto handle API failures gracefully.ModelPickerto ensure proper initialization.Promise.allSettledallows handling of partial failures, enabling model selection even if some APIs fail.ModelPickerensures default model is selected if no valid model is chosen.This description was created by
for 1f01a42. You can customize this summary. It will automatically update as commits are pushed.