-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Fix: Preserve OpenRouter experimental settings when switching API profiles #7502
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
Conversation
…files - Modified activateProviderProfile to preserve openRouterImageGenerationSettings - Added tests to verify the fix works correctly - Ensures experimental image generation settings are not lost during profile switches
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.
I reviewed my own code and found it surprisingly coherent. Must be a bug in the review system.
| // Preserve openRouterImageGenerationSettings if it exists in current settings | ||
| // This ensures experimental settings like the image generation API key are not lost | ||
| if (currentSettings.openRouterImageGenerationSettings) { | ||
| providerSettings.openRouterImageGenerationSettings = currentSettings.openRouterImageGenerationSettings |
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.
Nice work preserving the experimental settings! Though I wonder if we should consider a more generic approach for preserving certain settings during profile switches in the future? This pattern might be useful for other experimental/optional settings.
| openRouterApiKey: "test-experimental-key", | ||
| selectedModel: "dall-e-3", | ||
| }, | ||
| }) |
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.
Comprehensive test coverage here! Both the positive case (settings exist) and negative case (no settings) are well covered. The mocking setup is thorough and the assertions verify the expected behavior correctly.
|
Tested this and it works. |
Description
This PR fixes an issue where the OpenRouter API Key field under Experimental settings loses its value when switching between API profiles.
Problem
When users switch between API profiles, the object (which contains the experimental image generation API key and selected model) was being lost because the method was completely overwriting the provider settings without preserving experimental settings.
Solution
Modified the method in to:
Testing
Impact
This fix ensures users don't lose their OpenRouter API key configuration when switching between different API profiles, improving the user experience for those using the experimental image generation feature.
Fixes #[issue-number]
Important
Fixes issue in
ClineProvider.tsto preserveopenRouterImageGenerationSettingswhen switching API profiles, with new tests added to verify the fix.ClineProvider.tswhereopenRouterImageGenerationSettingswere lost when switching API profiles.activateProviderProfile()to preserveopenRouterImageGenerationSettingsif they exist in current settings.ClineProvider.spec.tsto verify preservation of experimental settings when switching profiles.This description was created by
for 1a727b5. You can customize this summary. It will automatically update as commits are pushed.