Skip to content

Commit 6879250

Browse files
committed
Expand image field support in tool prompts and rules
1 parent 0475606 commit 6879250

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/lib/server/textGeneration/mcp/fileRefs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ const DEFAULT_FIELD_RULES: FieldRule[] = [
9191
allowedPrefixes: ["image"],
9292
},
9393
{
94-
keys: ["input_image"],
94+
keys: ["input_image", "image", "image_url"],
9595
action: "replaceWithDataUrl",
9696
allowedPrefixes: ["image"],
9797
},

src/lib/server/textGeneration/utils/toolPrompt.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export function buildToolPreprompt(tools: OpenAiTool[]): string {
1515
`You can use the following tools if helpful: ${names.join(", ")}.`,
1616
`Today's date: ${currentDate}.`,
1717
`If a tool generates an image, you can inline it directly: ![alt text](image_url).`,
18-
`If a tool needs to operate on an image, set its image input parameter (for example, "input_image") to an image reference string.`,
19-
`Use "image_1", "image_2", etc. where the number equals the chronological order of user-uploaded images in this conversation (image_1 = first image uploaded, image_2 = second, and so on). You can also reuse a direct image URL from a prior tool result instead of pasting new base64 data.`,
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.`,
2020
].join(" ");
2121
}

0 commit comments

Comments
 (0)