Skip to content

Commit c265074

Browse files
authored
return only valid models in the API (#1064)
1 parent 815e76f commit c265074

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

src/routes/api/models/+server.ts

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
import { models } from "$lib/server/models";
22

33
export async function GET() {
4-
const res = models.map((model) => ({
5-
id: model.id,
6-
name: model.name,
7-
websiteUrl: model.websiteUrl,
8-
modelUrl: model.modelUrl,
9-
tokenizer: model.tokenizer,
10-
datasetName: model.datasetName,
11-
datasetUrl: model.datasetUrl,
12-
displayName: model.displayName,
13-
description: model.description ?? "",
14-
logoUrl: model.logoUrl,
15-
promptExamples: model.promptExamples ?? [],
16-
preprompt: model.preprompt,
17-
multimodal: model.multimodal,
18-
unlisted: model.unlisted,
19-
}));
4+
const res = models
5+
.filter((m) => m.unlisted == false)
6+
.map((model) => ({
7+
id: model.id,
8+
name: model.name,
9+
websiteUrl: model.websiteUrl ?? "https://huggingface.co",
10+
modelUrl: model.modelUrl ?? "https://huggingface.co",
11+
tokenizer: model.tokenizer,
12+
datasetName: model.datasetName,
13+
datasetUrl: model.datasetUrl,
14+
displayName: model.displayName,
15+
description: model.description ?? "",
16+
logoUrl: model.logoUrl,
17+
promptExamples: model.promptExamples ?? [],
18+
preprompt: model.preprompt ?? "",
19+
multimodal: model.multimodal ?? false,
20+
unlisted: model.unlisted ?? false,
21+
}));
2022
return Response.json(res);
2123
}

0 commit comments

Comments
 (0)