@tiens.nguyen/gonext-local-worker 1.0.70 → 1.0.72

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1081,10 +1081,13 @@ async function correctOcrText(extractedText, modelOverride = "") {
1081
1081
  "Return only the corrected text without any explanation.\n\n" +
1082
1082
  `Text:\n${extractedText}`;
1083
1083
  console.log(`[gonext-worker] OCR correction via CLI model=${modelPath}`);
1084
+ // Write prompt to a temp file so long text / special chars don't break --prompt arg.
1085
+ const promptFile = join(tmpdir(), `gonext-ocr-correct-${Date.now()}.txt`);
1084
1086
  try {
1087
+ await writeFile(promptFile, prompt, "utf8");
1085
1088
  const { stdout } = await execFile(
1086
1089
  "python3",
1087
- ["-m", "mlx_lm.generate", "--model", modelPath, "--prompt", prompt, "--max-tokens", "2048", "--temp", "0.0"],
1090
+ ["-m", "mlx_lm.generate", "--model", modelPath, "--prompt-file", promptFile, "--max-tokens", "2048", "--temp", "0.0"],
1088
1091
  { timeout: OCR_CORRECT_TIMEOUT_MS, maxBuffer: 10 * 1024 * 1024 }
1089
1092
  );
1090
1093
  const corrected = normalizeCorrection(stdout, extractedText);
@@ -1094,6 +1097,8 @@ async function correctOcrText(extractedText, modelOverride = "") {
1094
1097
  const msg = e instanceof Error ? e.message : String(e);
1095
1098
  console.warn(`[gonext-worker] OCR correction failed (using raw OCR text): ${msg.slice(0, 200)}`);
1096
1099
  return extractedText;
1100
+ } finally {
1101
+ await rm(promptFile, { force: true }).catch(() => {});
1097
1102
  }
1098
1103
  }
1099
1104
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiens.nguyen/gonext-local-worker",
3
- "version": "1.0.70",
3
+ "version": "1.0.72",
4
4
  "description": "Polls GoNext cloud API for async local LLM jobs and runs them against Ollama/OpenAI-compatible servers on this Mac",
5
5
  "type": "module",
6
6
  "license": "MIT",