Fix provider display (#641)
This commit is contained in:
committed by
GitHub
Unverified
parent
c6021cedf4
commit
859e3fd6c5
@@ -742,6 +742,18 @@ export async function getActiveOpenClawProviders(): Promise<Set<string>> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 3. agents.defaults.model.primary — the default model reference encodes
|
||||
// the provider prefix (e.g. "qwen-portal/coder-model" → "qwen-portal").
|
||||
// This covers providers that are active via OAuth or env-key but don't
|
||||
// have an explicit models.providers entry.
|
||||
const agents = config.agents as Record<string, unknown> | undefined;
|
||||
const defaults = agents?.defaults as Record<string, unknown> | undefined;
|
||||
const modelConfig = defaults?.model as Record<string, unknown> | undefined;
|
||||
const primaryModel = typeof modelConfig?.primary === 'string' ? modelConfig.primary : undefined;
|
||||
if (primaryModel?.includes('/')) {
|
||||
activeProviders.add(primaryModel.split('/')[0]);
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn('Failed to read openclaw.json for active providers:', err);
|
||||
}
|
||||
|
||||
@@ -285,8 +285,9 @@ export async function getAllProvidersWithKeyInfo(): Promise<
|
||||
const openClawKey = getOpenClawProviderKeyForType(provider.type, provider.id);
|
||||
const isActive = activeOpenClawProviders.has(provider.type) || activeOpenClawProviders.has(provider.id) || activeOpenClawProviders.has(openClawKey);
|
||||
if (configMissing || (!isBuiltin && !isActive)) {
|
||||
console.log(`[Sync] Provider ${provider.id} (${provider.type}) missing from OpenClaw, dropping from ClawX UI`);
|
||||
await deleteProvider(provider.id);
|
||||
console.log(`[Sync] Provider ${provider.id} (${provider.type}) missing from OpenClaw, hiding from UI`);
|
||||
// Skip from display but don't delete from store — preserves API key
|
||||
// associations so that restoring openclaw.json brings accounts back intact.
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user