fix: parse composite auth keys correctly in provider list and load apikeys

providers.ts:
- Use lastIndexOf + slice instead of split(':') for profile parsing

provider.ts:
- Extract base provider ID from composite auth keys (e.g., 'minimax-coding-plan:personal' → 'minimax-coding-plan')
- This fixes the issue where providers weren't recognized when using profile-based auth keys
pull/21353/head
PabloGNU 2026-04-07 15:40:52 +02:00
parent 2748cf9585
commit 15e104bca8
2 changed files with 7 additions and 2 deletions

View File

@ -228,7 +228,9 @@ export const ProvidersListCommand = cmd({
const byProvider: Record<string, Array<{ profile: string; type: string }>> = {}
for (const [compositeKey, result] of results) {
const [baseProvider, profile] = compositeKey.includes(":") ? compositeKey.split(":") : [compositeKey, "default"]
const lastColon = compositeKey.lastIndexOf(":")
const baseProvider = lastColon === -1 ? compositeKey : compositeKey.slice(0, lastColon)
const profile = lastColon === -1 ? "default" : compositeKey.slice(lastColon + 1)
if (!byProvider[baseProvider]) byProvider[baseProvider] = []
byProvider[baseProvider]!.push({ profile, type: result.type })
}

View File

@ -1192,7 +1192,10 @@ export namespace Provider {
// load apikeys
const auths = yield* auth.all().pipe(Effect.orDie)
for (const [id, provider] of Object.entries(auths)) {
const providerID = ProviderID.make(id)
// Extract base provider from composite keys (e.g., "minimax-coding-plan:personal" → "minimax-coding-plan")
const lastColon = id.lastIndexOf(":")
const baseProvider = lastColon === -1 ? id : id.slice(0, lastColon)
const providerID = ProviderID.make(baseProvider)
if (disabled.has(providerID)) continue
if (provider.type === "api") {
mergeProvider(providerID, {