Fix screenshot: formato immagine corretto {type:image, data: base64, mimeType} (il framework usa block.data, non source.data)
This commit is contained in:
@@ -26,6 +26,7 @@
|
|||||||
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
||||||
import { Type } from "typebox";
|
import { Type } from "typebox";
|
||||||
import { spawn, execFile } from "node:child_process";
|
import { spawn, execFile } from "node:child_process";
|
||||||
|
import { readFileSync } from "node:fs";
|
||||||
import { promisify } from "node:util";
|
import { promisify } from "node:util";
|
||||||
|
|
||||||
const execFileAsync = promisify(execFile);
|
const execFileAsync = promisify(execFile);
|
||||||
@@ -367,10 +368,11 @@ export default function (pi: ExtensionAPI) {
|
|||||||
),
|
),
|
||||||
"screenshot",
|
"screenshot",
|
||||||
);
|
);
|
||||||
|
const pngB64 = readFileSync(r.path).toString("base64");
|
||||||
return {
|
return {
|
||||||
content: [
|
content: [
|
||||||
{ type: "text", text: `Screenshot salvato in ${r.path} (${r.bytes} bytes)` },
|
{ type: "text", text: `Screenshot salvato in ${r.path} (${r.bytes} bytes)` },
|
||||||
{ type: "image", image: r.path, mediaType: "image/png" },
|
{ type: "image", data: pngB64, mimeType: "image/png" },
|
||||||
],
|
],
|
||||||
details: r,
|
details: r,
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user