mirror of
https://github.com/garrytan/gstack.git
synced 2026-09-28 15:41:57 +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:
co-authored by
Claude Opus 4.7
parent
c875e0c3fc
commit
6a8b637669
@@ -54,14 +54,14 @@ function flag(name: string): boolean {
|
|||||||
|
|
||||||
function parseProviders(s: string | undefined): Array<'claude' | 'gpt' | 'gemini'> {
|
function parseProviders(s: string | undefined): Array<'claude' | 'gpt' | 'gemini'> {
|
||||||
if (!s) return ['claude'];
|
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)) {
|
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 {
|
else {
|
||||||
console.error(`WARN: unknown provider '${p}' — skipping. Valid: claude, gpt, gemini.`);
|
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 {
|
function resolvePrompt(positional: string | undefined): string {
|
||||||
|
|||||||
Reference in New Issue
Block a user