fix: use consistent model comparison including provider

This commit is contained in:
Kao Félix 2025-12-25 22:10:08 +01:00
parent 64e7c80c7e
commit a7efe3d4c1
5 changed files with 25 additions and 17 deletions

View file

@ -3,7 +3,7 @@
*/
import type { ThinkingLevel } from "@mariozechner/pi-agent-core";
import type { Api, KnownProvider, Model } from "@mariozechner/pi-ai";
import { type Api, type KnownProvider, type Model, modelsAreEqual } from "@mariozechner/pi-ai";
import chalk from "chalk";
import { isValidThinkingLevel } from "../cli/args.js";
import type { ModelRegistry } from "./model-registry.js";
@ -184,7 +184,7 @@ export async function resolveModelScope(patterns: string[], modelRegistry: Model
}
// Avoid duplicates
if (!scopedModels.find((sm) => sm.model.id === model.id && sm.model.provider === model.provider)) {
if (!scopedModels.find((sm) => modelsAreEqual(sm.model, model))) {
scopedModels.push({ model, thinkingLevel });
}
}