fix: skip Anthropic model migration for third-party providers

Add provider guard to migrateSonnet1mToSonnet45() so it only runs for
firstParty (Anthropic) users. Without this, a 3P user with
model='sonnet[1m]' would have it rewritten to an Anthropic-specific
alias that is invalid for OpenAI/Gemini/Ollama providers.
This commit is contained in:
Juan Camilo
2026-04-02 09:29:53 +02:00
parent c94f9e18c3
commit 7a7437b309

View File

@@ -3,6 +3,7 @@ import {
setMainLoopModelOverride, setMainLoopModelOverride,
} from '../bootstrap/state.js' } from '../bootstrap/state.js'
import { getGlobalConfig, saveGlobalConfig } from '../utils/config.js' import { getGlobalConfig, saveGlobalConfig } from '../utils/config.js'
import { getAPIProvider } from '../utils/model/providers.js'
import { import {
getSettingsForSource, getSettingsForSource,
updateSettingsForSource, updateSettingsForSource,
@@ -23,6 +24,10 @@ import {
* tracked by a completion flag in global config. * tracked by a completion flag in global config.
*/ */
export function migrateSonnet1mToSonnet45(): void { export function migrateSonnet1mToSonnet45(): void {
if (getAPIProvider() !== 'firstParty') {
return
}
const config = getGlobalConfig() const config = getGlobalConfig()
if (config.sonnet1m45MigrationComplete) { if (config.sonnet1m45MigrationComplete) {
return return