Expand image field support in tool prompts and rules
Browse files
src/lib/server/textGeneration/mcp/fileRefs.ts
CHANGED
|
@@ -91,7 +91,7 @@ const DEFAULT_FIELD_RULES: FieldRule[] = [
|
|
| 91 |
allowedPrefixes: ["image"],
|
| 92 |
},
|
| 93 |
{
|
| 94 |
-
keys: ["input_image"],
|
| 95 |
action: "replaceWithDataUrl",
|
| 96 |
allowedPrefixes: ["image"],
|
| 97 |
},
|
|
|
|
| 91 |
allowedPrefixes: ["image"],
|
| 92 |
},
|
| 93 |
{
|
| 94 |
+
keys: ["input_image", "image", "image_url"],
|
| 95 |
action: "replaceWithDataUrl",
|
| 96 |
allowedPrefixes: ["image"],
|
| 97 |
},
|
src/lib/server/textGeneration/utils/toolPrompt.ts
CHANGED
|
@@ -15,7 +15,7 @@ export function buildToolPreprompt(tools: OpenAiTool[]): string {
|
|
| 15 |
`You can use the following tools if helpful: ${names.join(", ")}.`,
|
| 16 |
`Today's date: ${currentDate}.`,
|
| 17 |
`If a tool generates an image, you can inline it directly: .`,
|
| 18 |
-
`If a tool needs
|
| 19 |
-
`
|
| 20 |
].join(" ");
|
| 21 |
}
|
|
|
|
| 15 |
`You can use the following tools if helpful: ${names.join(", ")}.`,
|
| 16 |
`Today's date: ${currentDate}.`,
|
| 17 |
`If a tool generates an image, you can inline it directly: .`,
|
| 18 |
+
`If a tool needs an image, set its image field ("input_image", "image", or "image_url") to a reference like "image_1", "image_2", etc. (ordered by when the user uploaded them).`,
|
| 19 |
+
`Default to image references; only use a full http(s) URL when the tool description explicitly asks for one, or reuse a URL a previous tool returned.`,
|
| 20 |
].join(" ");
|
| 21 |
}
|