Kevin CATHALY Kevin CATHALY nsarrazin HF Staff commited on
Commit
e18e7a5
·
unverified ·
1 Parent(s): 99e8e46

add new parameter in model and conversation api (#1325)

Browse files

Co-authored-by: Kevin CATHALY <[email protected]>
Co-authored-by: Nathan Sarrazin <[email protected]>

src/routes/api/conversation/[id]/+server.ts CHANGED
@@ -1,6 +1,7 @@
1
  import { collections } from "$lib/server/database";
2
  import { authCondition } from "$lib/server/auth";
3
  import { z } from "zod";
 
4
  import { ObjectId } from "mongodb";
5
 
6
  export async function GET({ locals, params }) {
@@ -29,6 +30,7 @@ export async function GET({ locals, params }) {
29
  webSearch: message.webSearch,
30
  files: message.files,
31
  })),
 
32
  };
33
  return Response.json(res);
34
  } else {
 
1
  import { collections } from "$lib/server/database";
2
  import { authCondition } from "$lib/server/auth";
3
  import { z } from "zod";
4
+ import { models } from "$lib/server/models";
5
  import { ObjectId } from "mongodb";
6
 
7
  export async function GET({ locals, params }) {
 
30
  webSearch: message.webSearch,
31
  files: message.files,
32
  })),
33
+ modelTools: models.find((m) => m.id == conv.model)?.tools ?? false,
34
  };
35
  return Response.json(res);
36
  } else {
src/routes/api/conversations/+server.ts CHANGED
@@ -1,4 +1,5 @@
1
  import { collections } from "$lib/server/database";
 
2
  import { authCondition } from "$lib/server/auth";
3
  import type { Conversation } from "$lib/types/Conversation";
4
 
@@ -29,6 +30,7 @@ export async function GET({ locals, url }) {
29
  updatedAt: conv.updatedAt,
30
  modelId: conv.model,
31
  assistantId: conv.assistantId,
 
32
  }));
33
 
34
  return Response.json(res);
 
1
  import { collections } from "$lib/server/database";
2
+ import { models } from "$lib/server/models";
3
  import { authCondition } from "$lib/server/auth";
4
  import type { Conversation } from "$lib/types/Conversation";
5
 
 
30
  updatedAt: conv.updatedAt,
31
  modelId: conv.model,
32
  assistantId: conv.assistantId,
33
+ modelTools: models.find((m) => m.id == conv.model)?.tools ?? false,
34
  }));
35
 
36
  return Response.json(res);
src/routes/api/models/+server.ts CHANGED
@@ -18,6 +18,7 @@ export async function GET() {
18
  preprompt: model.preprompt ?? "",
19
  multimodal: model.multimodal ?? false,
20
  unlisted: model.unlisted ?? false,
 
21
  }));
22
  return Response.json(res);
23
  }
 
18
  preprompt: model.preprompt ?? "",
19
  multimodal: model.multimodal ?? false,
20
  unlisted: model.unlisted ?? false,
21
+ tools: model.tools ?? false,
22
  }));
23
  return Response.json(res);
24
  }