feat: add element screenshot action for snapshots (#182)

This commit is contained in:
Andrei-Daniel Barzu
2025-04-16 20:28:44 +03:00
committed by GitHub
parent e7c7709b33
commit 6d4adfe5c6
2 changed files with 53 additions and 7 deletions

View File

@@ -176,6 +176,12 @@ export class Context {
type RunResult = {
code: string[];
images?: ImageContent[];
};
type ImageContent = {
data: string;
mimeType: string;
};
class Tab {
@@ -243,8 +249,16 @@ ${runResult.code.join('\n')}
result.push(this._snapshot.text({ hasFileChooser: !!this._fileChooser }));
}
const images = runResult.images?.map(image => {
return {
type: 'image' as 'image',
data: image.data,
mimeType: image.mimeType,
};
}) ?? [];
return {
content: [{
content: [...images, {
type: 'text',
text: result.join('\n'),
}],