Fix provider display (#641)

This commit is contained in:
paisley
2026-03-23 19:11:53 +08:00
committed by GitHub
Unverified
parent c6021cedf4
commit 859e3fd6c5
4 changed files with 162 additions and 58 deletions

View File

@@ -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);
}