feat: better config
CI / verify (pull_request) Successful in 9s

This commit is contained in:
2026-09-19 13:12:03 +02:00
parent a183975b8a
commit 80728e7d75
6 changed files with 277 additions and 65 deletions
+10 -3
View File
@@ -20,13 +20,20 @@ function priority(model: ModelInfo) {
: undefined;
}
export async function discover(context: Plugin.Context, providerID: string) {
export function modelKey(providerID: string, modelID: string) {
return `${providerID}\0${modelID}`;
}
export async function discover(context: Plugin.Context, detectPriority: boolean) {
// Native lists already apply activation, integrations, configuration, and model transforms.
const { data } = await context.model.list();
const models = new Map<string, { model: ModelInfo; serviceTier: string | undefined }>();
for (const model of data) {
if (model.providerID === providerID && model.enabled)
models.set(model.id, { model, serviceTier: priority(model) });
if (model.enabled)
models.set(modelKey(model.providerID, model.id), {
model,
serviceTier: detectPriority ? priority(model) : undefined,
});
}
return models;
}