fix: auto-select usable provider when local model is stale#126
Open
nkmohit wants to merge 2 commits intoTHU-MAIC:mainfrom
Open
fix: auto-select usable provider when local model is stale#126nkmohit wants to merge 2 commits intoTHU-MAIC:mainfrom
nkmohit wants to merge 2 commits intoTHU-MAIC:mainfrom
Conversation
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.
Summary
Fixes LLM auto-selection when stale localStorage keeps a non-empty but unusable provider/model selection. Previously,
fetchServerProviders()only auto-selected a server-configured LLM whenmodelIdwas empty, so persisted selections likeopenai:gpt-4ocould remain active even when that provider had no client API key and no server-side configuration.Related Issues
Fixes #118
Changes
isProviderUsable(...)check insidefetchServerProviders()inlib/store/settings.tsmodelIdis empty, orType of Change
Verification
Steps to reproduce / test
googleis server-configured andopenaiis notmainproviderId = openaimodelId = gpt-4omainWhat you personally verified
main, with onlygoogleserver-configured, I forced stale localStorage to:providerId = openaimodelId = gpt-4oopenai gpt-4ofix/llm-autoselect-unusable-provider, with the same stale localStorage setup, the app auto-switched to:google gemini-3.1-pro-previewpnpm exec tsc --noEmitpnpm lint lib/store/settings.tsEvidence
pnpm check && pnpm lint && npx tsc --noEmit)before (main): openai gpt-4o
after (fix branch): google gemini-3.1-pro-preview
Checklist