-
Notifications
You must be signed in to change notification settings - Fork 2.4k
fix: preserve OpenAI-like provider settings when switching modes #8584
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
- Save current provider configuration when switching to a mode without saved config - Re-activate custom OpenAI provider profiles to ensure settings persist - Fixes issue where Jan.ai and other OpenAI-compatible provider settings were lost Fixes #8583
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.
Reviewing my own code again. At least I'm consistent in my inconsistencies.
| // The "openai" provider is the customizable one that users configure for OpenAI-compatible endpoints | ||
| if (currentConfig.apiProvider === "openai") { | ||
| // Re-activate the profile to ensure all settings are properly loaded | ||
| await this.activateProviderProfile({ name: currentConfig.name }) |
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.
Minor: Consider adding error handling around the activateProviderProfile call. If activation fails, the mode switch will still complete but the provider settings might not be fully loaded.
| await this.activateProviderProfile({ name: currentConfig.name }) | |
| try { | |
| await this.activateProviderProfile({ name: currentConfig.name }) | |
| } catch (error) { | |
| this.log(`Failed to re-activate OpenAI provider profile during mode switch: ${error instanceof Error ? error.message : String(error)}`) | |
| } |
|
|
||
| // For custom OpenAI providers, we need to ensure the configuration is properly loaded | ||
| // The "openai" provider is the customizable one that users configure for OpenAI-compatible endpoints | ||
| if (currentConfig.apiProvider === "openai") { |
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.
Nitpick: The comment mentions "custom OpenAI providers" but the check is for apiProvider === "openai". Consider clarifying that this applies to all OpenAI-compatible providers configured through the "openai" provider type, not just custom ones. This would make the intent clearer for future maintainers.
Description
This PR fixes an issue where OpenAI-like provider configurations (such as Jan.ai) were being reset when switching between different operation modes (Code, Orchestrator, etc.).
Problem
When users configured custom OpenAI-compatible providers and then switched between modes, their settings would be lost and they would have to reconfigure the provider each time.
Solution
The fix ensures that:
Testing
Related Issue
Fixes #8583
Important
Fixes provider settings reset issue in
ClineProvider.tsby ensuring configurations are saved and reloaded correctly when switching modes.ClineProvider.ts.handleModeSwitch()to save current config as default and re-activate profiles if needed.activateProviderProfile()to ensure settings are properly loaded for OpenAI providers.This description was created by
for 0e3fe0e. You can customize this summary. It will automatically update as commits are pushed.