fix: preserve explicit ollama startup intent
This commit is contained in:
@@ -100,4 +100,17 @@ describe('filterSettingsEnvForExplicitProvider', () => {
|
||||
}),
|
||||
).toEqual({ OTHER: 'keep-me' })
|
||||
})
|
||||
|
||||
test('preserves explicit ollama startup intent by stripping OpenAI routing settings', () => {
|
||||
process.env.CLAUDE_CODE_EXPLICIT_PROVIDER = 'ollama'
|
||||
|
||||
expect(
|
||||
filterSettingsEnvForExplicitProvider({
|
||||
OPENAI_BASE_URL: 'https://api.openai.com/v1',
|
||||
OPENAI_MODEL: 'gpt-4o',
|
||||
OPENAI_API_KEY: 'sk-test',
|
||||
OTHER: 'keep-me',
|
||||
}),
|
||||
).toEqual({ OTHER: 'keep-me' })
|
||||
})
|
||||
})
|
||||
|
||||
@@ -41,6 +41,13 @@ export function filterSettingsEnvForExplicitProvider(
|
||||
delete filtered[key]
|
||||
}
|
||||
|
||||
if (explicitProvider === 'ollama') {
|
||||
delete filtered.OPENAI_BASE_URL
|
||||
delete filtered.OPENAI_MODEL
|
||||
delete filtered.OPENAI_API_KEY
|
||||
return filtered
|
||||
}
|
||||
|
||||
if (explicitProvider === 'github') {
|
||||
if (!isGithubModel(filtered.OPENAI_MODEL)) {
|
||||
delete filtered.OPENAI_MODEL
|
||||
|
||||
Reference in New Issue
Block a user