| 88 | aggregateProvidersByScope(providers, "cn", "cn", "China AI Providers", "Aggregated China AI provider rules."), |
| 89 | aggregateProvidersByScope(providers, "global", "global", "Global AI Providers", "Aggregated global AI provider rules."), |
| 90 | aggregateProviders(providers) |
| 91 | ]; |
| 92 | } |
| 93 | |
| 94 | return providerTargets; |
| 95 | } |
| 96 | |
| 97 | function parseFormats(formatOption: string): Format[] { |
| 98 | const selected = parseCsv(formatOption); |
| 99 | |
| 100 | if (selected.includes("all")) { |
| 101 | return [...formats]; |
| 102 | } |
| 103 | |
| 104 | const invalid = selected.filter((format): format is string => !isFormat(format)); |
| 105 | if (invalid.length > 0) { |
| 106 | throw new Error(`Invalid format: ${invalid.join(", ")}`); |