diff --git a/package.json b/package.json index e7befb9..c930397 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ztimson/ai-utils", - "version": "1.0.3", + "version": "1.0.4", "description": "AI Utility library", "author": "Zak Timson", "license": "MIT", diff --git a/src/memory.ts b/src/memory.ts index 46bdc8a..542fe00 100644 --- a/src/memory.ts +++ b/src/memory.ts @@ -95,7 +95,7 @@ Rules: - ONLY extract decisions that were MADE during this conversation - DO NOT extract anything the AI said, its name, capabilities, or how it introduced itself - DO NOT extract greetings, pleasantries or generic exchanges -- If nothing worth remembering was said, call NO tools +- If nothing worth remembering was said, dont do anything, skip calling tools For each fact decide whether it belongs in an existing document or needs a new one, then call the \`extract_facts\` tool. diff --git a/src/vision.ts b/src/vision.ts index 42ff563..ab617eb 100644 --- a/src/vision.ts +++ b/src/vision.ts @@ -12,12 +12,12 @@ export class Vision { */ ocr(path: string): AbortablePromise { let worker: any; - const p = new Promise(async res => { + const p = (async () => { worker = await createWorker(this.ai.options.ocr || 'eng', 2, {cachePath: this.ai.options.path}); const {data} = await worker.recognize(path); await worker.terminate(); - res(data.text.trim() || null); - }).finally(() => worker?.terminate()); + return data.text.trim() || null; + })().finally(() => worker?.terminate()); return Object.assign(p, {abort: () => worker?.terminate()}); } }