nsarrazin commited on
Commit
67302d2
·
1 Parent(s): 56c5d3c

fix: make sure document parser is disabled if not required

Browse files
src/lib/server/endpoints/inference-client/endpointInferenceClient.ts CHANGED
@@ -87,9 +87,6 @@ export const endpointInferenceClientParametersSchema = z.object({
87
  weight: z.number().int().positive().default(1),
88
  model: z.any(),
89
  provider: z.enum(INFERENCE_PROVIDERS).optional(),
90
- supportedRoles: z
91
- .array(z.enum(["user", "assistant", "system", "tool"]))
92
- .default(["user", "assistant", "system", "tool"]),
93
  modelName: z.string().optional(),
94
  baseURL: z.string().optional(),
95
  multimodal: z
 
87
  weight: z.number().int().positive().default(1),
88
  model: z.any(),
89
  provider: z.enum(INFERENCE_PROVIDERS).optional(),
 
 
 
90
  modelName: z.string().optional(),
91
  baseURL: z.string().optional(),
92
  multimodal: z
src/lib/server/tools/directlyAnswer.ts CHANGED
@@ -4,7 +4,8 @@ import { ObjectId } from "mongodb";
4
  const directlyAnswer: ConfigTool = {
5
  _id: new ObjectId("00000000000000000000000D"),
6
  type: "config",
7
- description: "Answer the user's query directly",
 
8
  color: "blue",
9
  icon: "chat",
10
  displayName: "Directly Answer",
 
4
  const directlyAnswer: ConfigTool = {
5
  _id: new ObjectId("00000000000000000000000D"),
6
  type: "config",
7
+ description:
8
+ "Answer the user's query directly. You must use this tool before you can answer the user's query.",
9
  color: "blue",
10
  icon: "chat",
11
  displayName: "Directly Answer",
src/routes/conversation/[id]/+page.svelte CHANGED
@@ -27,6 +27,7 @@
27
 
28
  import "katex/dist/katex.min.css";
29
  import { updateDebouncer } from "$lib/utils/updates.js";
 
30
 
31
  let { data = $bindable() } = $props();
32
 
@@ -252,6 +253,13 @@
252
  // disable websearch if assistant is present
253
  const hasAssistant = !!page.data.assistant;
254
  const messageUpdatesAbortController = new AbortController();
 
 
 
 
 
 
 
255
  const messageUpdatesIterator = await fetchMessageUpdates(
256
  page.params.id,
257
  {
@@ -261,7 +269,7 @@
261
  isRetry,
262
  isContinue,
263
  webSearch: !hasAssistant && !activeModel.tools && $webSearchParameters.useSearch,
264
- tools: $settings.tools, // preference for tools
265
  files: isRetry ? userMessage?.files : base64Files,
266
  },
267
  messageUpdatesAbortController.signal
 
27
 
28
  import "katex/dist/katex.min.css";
29
  import { updateDebouncer } from "$lib/utils/updates.js";
30
+ import { documentParserToolId } from "$lib/utils/toolIds.js";
31
 
32
  let { data = $bindable() } = $props();
33
 
 
253
  // disable websearch if assistant is present
254
  const hasAssistant = !!page.data.assistant;
255
  const messageUpdatesAbortController = new AbortController();
256
+
257
+ let tools = $settings.tools;
258
+
259
+ if (!files.some((file) => file.type.startsWith("application/"))) {
260
+ tools = $settings.tools?.filter((tool) => tool !== documentParserToolId);
261
+ }
262
+
263
  const messageUpdatesIterator = await fetchMessageUpdates(
264
  page.params.id,
265
  {
 
269
  isRetry,
270
  isContinue,
271
  webSearch: !hasAssistant && !activeModel.tools && $webSearchParameters.useSearch,
272
+ tools,
273
  files: isRetry ? userMessage?.files : base64Files,
274
  },
275
  messageUpdatesAbortController.signal