-
-
Notifications
You must be signed in to change notification settings - Fork 502
Refactor model API key handling and improve model filtering. #2003
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: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
bugbot run |
# Conflicts: # src/settings/v2/components/ModelAddDialog.tsx
7df7024 to
c59b603
Compare
Changed REQUIRED_MODELS from a top-level constant to a getter function to avoid circular dependency issues during module initialization. This fixes test failures where ChatModels enum was accessed before being fully initialized. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
|
@Emt-lin I've removed the popups complaining about no API key during onboarding #2015. As byproduct, I removed the logic that forbids the user to switch to a default model without API key. Now every "no API key" error should show as AI response errorblock. As for the model picker in chat input, we should simply hide those models with no API key. Does this PR get affected by this design above? And could you please resolve conflict and rebase? thanks! |
Summary
Key Changes
src/utils/modelUtils.tswithgetApiKeyForProvider()andisRequiredChatModel()helpersFiles Changed
src/utils/modelUtils.ts(new file, 54 lines)src/components/ui/ModelSelector.tsxsrc/settings/v2/components/ApiKeyDialog.tsxsrc/settings/v2/components/ModelAddDialog.tsxsrc/settings/v2/components/ModelEditDialog.tsxsrc/settings/v2/components/ModelTable.tsxsrc/utils.tsNote
Centralizes API key logic in
utils/modelUtils, filters selectable models by API key or required status, and disables toggling of required models, updating dialogs and utils accordingly.src/utils/modelUtils.tswithgetApiKeyForProvider()andisRequiredChatModel().src/components/ui/ModelSelector.tsx: Show only models with valid API keys or required models; use filtered list for selection/restore.src/settings/v2/components/ModelTable.tsx: Disable enable toggle for required chat models.src/settings/v2/components/ApiKeyDialog.tsx,ModelAddDialog.tsx,ModelEditDialog.tsx: UsegetApiKeyForProvider()for consistent key retrieval.src/utils.ts: SimplifygetNeedSetKeyProvider(); updatecheckModelApiKey()to use centralized key lookup and improved notices.Written by Cursor Bugbot for commit 1a29fee. This will update automatically on new commits. Configure here.