diff --git a/electron/main/ipc-handlers.ts b/electron/main/ipc-handlers.ts index 562ede4..29e588f 100644 --- a/electron/main/ipc-handlers.ts +++ b/electron/main/ipc-handlers.ts @@ -1192,7 +1192,7 @@ function registerProviderHandlers(gatewayManager: GatewayManager): void { // authHeader immediately, without waiting for Gateway to sync openclaw.json. try { const defaultModelId = provider.model?.split('/').pop(); - updateAgentModelProvider(targetProviderKey, { + await updateAgentModelProvider(targetProviderKey, { baseUrl, api, authHeader: targetProviderKey === 'minimax-portal' ? true : undefined, diff --git a/electron/utils/openclaw-auth.ts b/electron/utils/openclaw-auth.ts index 5a659e3..6f2a89e 100644 --- a/electron/utils/openclaw-auth.ts +++ b/electron/utils/openclaw-auth.ts @@ -181,12 +181,12 @@ export async function saveOAuthTokenToOpenClaw( * @param agentId - Optional single agent ID to read from, defaults to 'main' * @returns The OAuth token access string or null if not found */ -export function getOAuthTokenFromOpenClaw( +export async function getOAuthTokenFromOpenClaw( provider: string, agentId = 'main' -): string | null { +): Promise { try { - const store = readAuthProfiles(agentId); + const store = await readAuthProfiles(agentId); const profileId = `${provider}:default`; const profile = store.profiles[profileId]; diff --git a/electron/utils/secure-storage.ts b/electron/utils/secure-storage.ts index 55fa2a2..9f717dd 100644 --- a/electron/utils/secure-storage.ts +++ b/electron/utils/secure-storage.ts @@ -214,7 +214,7 @@ export async function getAllProvidersWithKeyInfo(): Promise< > { const providers = await getAllProviders(); const results: Array = []; - const activeOpenClawProviders = getActiveOpenClawProviders(); + const activeOpenClawProviders = await getActiveOpenClawProviders(); // We need to avoid deleting native ones like 'anthropic' or 'google' // that don't need to exist in openclaw.json models.providers