From 3fd5c61b66a9be9cfb4bf2ae4d4bebd414ae08bd Mon Sep 17 00:00:00 2001 From: Brewen Couaran <45310490+brewcoua@users.noreply.github.com> Date: Fri, 14 Jun 2024 13:29:36 +0200 Subject: [PATCH] fix(prompts): use relative path for example screenshots and pack assets --- release.config.mjs | 2 +- src/services/mind/MindTransformer.ts | 10 +++++++--- src/services/runner/Runner.ts | 13 ------------- 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/release.config.mjs b/release.config.mjs index b1ca0f6..07b5ca7 100644 --- a/release.config.mjs +++ b/release.config.mjs @@ -13,7 +13,7 @@ export default { '@semantic-release/exec', { prepareCmd: - 'mkdir -p dist && cp package.json README.md LICENSE* dist', + 'mkdir -p dist && cp -r package.json README.md LICENSE* assets dist', }, ], [ diff --git a/src/services/mind/MindTransformer.ts b/src/services/mind/MindTransformer.ts index 9ba2576..fd8de66 100644 --- a/src/services/mind/MindTransformer.ts +++ b/src/services/mind/MindTransformer.ts @@ -1,4 +1,5 @@ import { readFileSync } from 'node:fs' +import { join as joinPath } from 'node:path' import config from '../runner/RunnerConfig' import AbstractAction from '../runner/domain/AbstractAction' @@ -117,9 +118,12 @@ export default class MindTransformer { private makeExamplePrompts(examples: PromptExample[]): Message[] { return examples.flatMap((example) => { - const screenshotBuf = readFileSync(example.screenshot, { - encoding: 'base64', - }) + const screenshotBuf = readFileSync( + joinPath(__dirname, example.screenshot), + { + encoding: 'base64', + } + ) return [ { diff --git a/src/services/runner/Runner.ts b/src/services/runner/Runner.ts index 83100d1..8310299 100644 --- a/src/services/runner/Runner.ts +++ b/src/services/runner/Runner.ts @@ -195,17 +195,4 @@ export default class Runner extends Service { private async sleep(ms: number): Promise { return new Promise((resolve) => setTimeout(resolve, ms)) } - - public on_action(listener: (action: ActionReport) => void): this { - return super.on('action', listener) - } - public on_status(listener: (status: RunnerStatus) => void): this { - return super.on('status', listener) - } - public off_action(listener: (action: ActionReport) => void): this { - return super.off('action', listener) - } - public off_status(listener: (status: RunnerStatus) => void): this { - return super.off('status', listener) - } }