fix(provider): ollama provider fix (#246)

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Haze <hazeone@users.noreply.github.com>
This commit is contained in:
Haze
2026-03-01 17:40:07 +08:00
committed by GitHub
Unverified
parent a8f61d5a61
commit 7d0621dcc2
4 changed files with 48 additions and 5 deletions

View File

@@ -103,7 +103,7 @@ const defaultSkills: DefaultSkill[] = [
{ id: 'terminal', name: 'Terminal', description: 'Shell command execution' },
];
import { SETUP_PROVIDERS, type ProviderTypeInfo, getProviderIconUrl, shouldInvertInDark } from '@/lib/providers';
import { SETUP_PROVIDERS, type ProviderTypeInfo, getProviderIconUrl, resolveProviderApiKeyForSave, shouldInvertInDark } from '@/lib/providers';
import clawxIcon from '@/assets/logo.svg';
// Use the shared provider registry for setup providers
@@ -970,6 +970,8 @@ function ProviderContent({
: `custom-${crypto.randomUUID()}`)
: selectedProvider;
const effectiveApiKey = resolveProviderApiKeyForSave(selectedProvider, apiKey);
// Save provider config + API key, then set as default
const saveResult = await window.electron.ipcRenderer.invoke(
'provider:save',
@@ -983,7 +985,7 @@ function ProviderContent({
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
},
apiKey || undefined
effectiveApiKey
) as { success: boolean; error?: string };
if (!saveResult.success) {