fix(image): accept @-prefixed file paths

This commit is contained in:
Peter Steinberger
2026-01-12 20:53:16 +00:00
parent 6f496b7739
commit cd12ad8aab
4 changed files with 11 additions and 4 deletions

View File

@@ -182,7 +182,7 @@ describe("image tool implicit imageModel config", () => {
const res = await tool.execute("t1", {
prompt: "Describe the image.",
image: "/Users/steipete/.clawdbot/media/inbound/photo.png",
image: "@/Users/steipete/.clawdbot/media/inbound/photo.png",
});
expect(fetch).toHaveBeenCalledTimes(1);

View File

@@ -440,8 +440,11 @@ export function createImageTool(options?: {
args && typeof args === "object"
? (args as Record<string, unknown>)
: {};
const imageRaw =
const imageRawInput =
typeof record.image === "string" ? record.image.trim() : "";
const imageRaw = imageRawInput.startsWith("@")
? imageRawInput.slice(1).trim()
: imageRawInput;
if (!imageRaw) throw new Error("image required");
const promptRaw =
typeof record.prompt === "string" && record.prompt.trim()