Compare commits

..

1 Commits
1.0.3 ... 1.0.4

Author SHA1 Message Date
3121d542d4 OCR
All checks were successful
Publish Library / Build NPM Project (push) Successful in 1m4s
Publish Library / Tag Version (push) Successful in 17s
2026-06-09 08:29:46 -04:00
3 changed files with 5 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name": "@ztimson/ai-utils", "name": "@ztimson/ai-utils",
"version": "1.0.3", "version": "1.0.4",
"description": "AI Utility library", "description": "AI Utility library",
"author": "Zak Timson", "author": "Zak Timson",
"license": "MIT", "license": "MIT",

View File

@@ -95,7 +95,7 @@ Rules:
- ONLY extract decisions that were MADE during this conversation - 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 anything the AI said, its name, capabilities, or how it introduced itself
- DO NOT extract greetings, pleasantries or generic exchanges - 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. For each fact decide whether it belongs in an existing document or needs a new one, then call the \`extract_facts\` tool.

View File

@@ -12,12 +12,12 @@ export class Vision {
*/ */
ocr(path: string): AbortablePromise<string | null> { ocr(path: string): AbortablePromise<string | null> {
let worker: any; let worker: any;
const p = new Promise<string | null>(async res => { const p = (async () => {
worker = await createWorker(this.ai.options.ocr || 'eng', 2, {cachePath: this.ai.options.path}); worker = await createWorker(this.ai.options.ocr || 'eng', 2, {cachePath: this.ai.options.path});
const {data} = await worker.recognize(path); const {data} = await worker.recognize(path);
await worker.terminate(); await worker.terminate();
res(data.text.trim() || null); return data.text.trim() || null;
}).finally(() => worker?.terminate()); })().finally(() => worker?.terminate());
return Object.assign(p, {abort: () => worker?.terminate()}); return Object.assign(p, {abort: () => worker?.terminate()});
} }
} }