mirror of
https://github.com/garrytan/gstack.git
synced 2026-05-06 21:46:40 +02:00
fix(benchmark): dedupe providers in --models
`--models claude,claude,gpt` previously produced a list with a duplicate entry, meaning the benchmark would run claude twice and bill for two runs. Surfaced by /review on this branch. Use a Set internally; return Array.from(seen) to preserve type + order of first occurrence. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -54,14 +54,14 @@ function flag(name: string): boolean {
|
||||
|
||||
function parseProviders(s: string | undefined): Array<'claude' | 'gpt' | 'gemini'> {
|
||||
if (!s) return ['claude'];
|
||||
const out: Array<'claude' | 'gpt' | 'gemini'> = [];
|
||||
const seen = new Set<'claude' | 'gpt' | 'gemini'>();
|
||||
for (const p of s.split(',').map(x => x.trim()).filter(Boolean)) {
|
||||
if (p === 'claude' || p === 'gpt' || p === 'gemini') out.push(p);
|
||||
if (p === 'claude' || p === 'gpt' || p === 'gemini') seen.add(p);
|
||||
else {
|
||||
console.error(`WARN: unknown provider '${p}' — skipping. Valid: claude, gpt, gemini.`);
|
||||
}
|
||||
}
|
||||
return out.length ? out : ['claude'];
|
||||
return seen.size ? Array.from(seen) : ['claude'];
|
||||
}
|
||||
|
||||
function resolvePrompt(positional: string | undefined): string {
|
||||
|
||||
Reference in New Issue
Block a user