mirror of
https://github.com/YspCoder/clawgo.git
synced 2026-05-13 13:39:41 +08:00
feat: align cliproxyapi providers and auto fallback
This commit is contained in:
@@ -44,11 +44,31 @@ func aistudioChannelID(providerName string, options map[string]interface{}) stri
|
||||
}
|
||||
|
||||
func aistudioChannelCandidates(providerName string, options map[string]interface{}) []string {
|
||||
for _, key := range []string{"aistudio_channel", "aistudio_provider", "relay_provider"} {
|
||||
for _, key := range []string{"aistudio_channel", "aistudio_provider", "relay_provider", "channel_id", "provider_id"} {
|
||||
if value, ok := stringOption(options, key); ok && strings.TrimSpace(value) != "" {
|
||||
return []string{strings.ToLower(strings.TrimSpace(value))}
|
||||
}
|
||||
}
|
||||
for _, key := range []string{"aistudio_channels", "channel_ids", "relay_providers"} {
|
||||
if values, ok := stringSliceOption(options, key); ok && len(values) > 0 {
|
||||
out := make([]string, 0, len(values))
|
||||
seen := map[string]struct{}{}
|
||||
for _, value := range values {
|
||||
channelID := strings.ToLower(strings.TrimSpace(value))
|
||||
if channelID == "" {
|
||||
continue
|
||||
}
|
||||
if _, exists := seen[channelID]; exists {
|
||||
continue
|
||||
}
|
||||
seen[channelID] = struct{}{}
|
||||
out = append(out, channelID)
|
||||
}
|
||||
if len(out) > 0 {
|
||||
return out
|
||||
}
|
||||
}
|
||||
}
|
||||
if runtimeSelected := preferredAIStudioRelayChannels(); len(runtimeSelected) > 0 {
|
||||
return runtimeSelected
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user