mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-12 07:20:45 +00:00
acp: forward attachments into ACP runtime sessions (#41427)
Merged via squash.
Prepared head SHA: f2ac51df2c
Co-authored-by: mbelinky <132747814+mbelinky@users.noreply.github.com>
Co-authored-by: mbelinky <132747814+mbelinky@users.noreply.github.com>
Reviewed-by: @mbelinky
This commit is contained in:
@@ -310,7 +310,20 @@ export class AcpxRuntime implements AcpRuntime {
|
||||
// Ignore EPIPE when the child exits before stdin flush completes.
|
||||
});
|
||||
|
||||
child.stdin.end(input.text);
|
||||
if (input.attachments && input.attachments.length > 0) {
|
||||
const blocks: unknown[] = [];
|
||||
if (input.text) {
|
||||
blocks.push({ type: "text", text: input.text });
|
||||
}
|
||||
for (const attachment of input.attachments) {
|
||||
if (attachment.mediaType.startsWith("image/")) {
|
||||
blocks.push({ type: "image", mimeType: attachment.mediaType, data: attachment.data });
|
||||
}
|
||||
}
|
||||
child.stdin.end(blocks.length > 0 ? JSON.stringify(blocks) : input.text);
|
||||
} else {
|
||||
child.stdin.end(input.text);
|
||||
}
|
||||
|
||||
let stderr = "";
|
||||
child.stderr.on("data", (chunk) => {
|
||||
|
||||
Reference in New Issue
Block a user