mirror of
https://github.com/tiennm99/ccs.git
synced 2026-07-15 20:20:09 +00:00
fix(cliproxy/sync): dedup ANTHROPIC_EXTRA_MODELS entries against primary model
This commit is contained in:
@@ -150,14 +150,21 @@ export function mapProfileToClaudeKey(profile: SyncableProfile): ClaudeKey | nul
|
||||
},
|
||||
];
|
||||
|
||||
// Append extra models from ANTHROPIC_EXTRA_MODELS env var (comma-separated)
|
||||
// Append extra models from ANTHROPIC_EXTRA_MODELS env var (comma-separated).
|
||||
// Skip duplicates of the primary model and any repeated entries to keep
|
||||
// the synced CLIProxy `models` array clean.
|
||||
const extraModelsRaw = env.ANTHROPIC_EXTRA_MODELS;
|
||||
if (extraModelsRaw && extraModelsRaw.trim()) {
|
||||
const seen = new Set<string>([modelName]);
|
||||
const extraModels = extraModelsRaw
|
||||
.split(',')
|
||||
.map((m) => m.trim())
|
||||
.filter((m) => m.length > 0);
|
||||
for (const extra of extraModels) {
|
||||
if (seen.has(extra)) {
|
||||
continue;
|
||||
}
|
||||
seen.add(extra);
|
||||
claudeKey.models.push({
|
||||
name: extra,
|
||||
alias: '',
|
||||
|
||||
Reference in New Issue
Block a user