chore: Enable "curly" rule to avoid single-statement if confusion/errors.

This commit is contained in:
cpojer
2026-01-31 16:19:20 +09:00
parent 009b16fab8
commit 5ceff756e1
1266 changed files with 27871 additions and 9393 deletions

View File

@@ -45,14 +45,18 @@ export async function loadModelCatalog(params?: {
if (params?.useCache === false) {
modelCatalogPromise = null;
}
if (modelCatalogPromise) return modelCatalogPromise;
if (modelCatalogPromise) {
return modelCatalogPromise;
}
modelCatalogPromise = (async () => {
const models: ModelCatalogEntry[] = [];
const sortModels = (entries: ModelCatalogEntry[]) =>
entries.sort((a, b) => {
const p = a.provider.localeCompare(b.provider);
if (p !== 0) return p;
if (p !== 0) {
return p;
}
return a.name.localeCompare(b.name);
});
try {
@@ -74,9 +78,13 @@ export async function loadModelCatalog(params?: {
const entries = Array.isArray(registry) ? registry : registry.getAll();
for (const entry of entries) {
const id = String(entry?.id ?? "").trim();
if (!id) continue;
if (!id) {
continue;
}
const provider = String(entry?.provider ?? "").trim();
if (!provider) continue;
if (!provider) {
continue;
}
const name = String(entry?.name ?? id).trim() || id;
const contextWindow =
typeof entry?.contextWindow === "number" && entry.contextWindow > 0