Kevin CATHALY commited on
Commit
c265074
1 Parent(s): 815e76f

return only valid models in the API (#1064)

Browse files
Files changed (1) hide show
  1. src/routes/api/models/+server.ts +18 -16
src/routes/api/models/+server.ts CHANGED
@@ -1,21 +1,23 @@
1
  import { models } from "$lib/server/models";
2
 
3
  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
- }));
 
 
20
  return Response.json(res);
21
  }
1
  import { models } from "$lib/server/models";
2
 
3
  export async function GET() {
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
+ }));
22
  return Response.json(res);
23
  }