@tiens.nguyen/gonext-local-worker 1.0.220 → 1.0.222

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.
@@ -1249,8 +1249,15 @@ async function correctOcrTextViaOpenAI(extractedText, base, model) {
1249
1249
  model,
1250
1250
  stream: false,
1251
1251
  temperature: 0,
1252
+ // Qwen3 (and other reasoning models) emit a <think> trace by default. Over the
1253
+ // OpenAI /v1 API there's no `think:false` flag, so use Qwen3's `/no_think` SOFT
1254
+ // SWITCH (honored by its chat template, same as the agent loop) to suppress it —
1255
+ // otherwise the model spends its whole token budget reasoning and returns no
1256
+ // corrected text (seen live: correction was a no-op, chars unchanged). Generous
1257
+ // max_tokens so a long OCR page isn't truncated.
1258
+ max_tokens: 4096,
1252
1259
  messages: [
1253
- { role: "system", content: OCR_CORRECT_SYSTEM_PROMPT },
1260
+ { role: "system", content: `${OCR_CORRECT_SYSTEM_PROMPT}\n/no_think` },
1254
1261
  { role: "user", content: `Text:\n${extractedText}` },
1255
1262
  ],
1256
1263
  }),
@@ -1261,7 +1268,13 @@ async function correctOcrTextViaOpenAI(extractedText, base, model) {
1261
1268
  }
1262
1269
  const json = await res.json();
1263
1270
  let corrected = json?.choices?.[0]?.message?.content?.trim() || "";
1264
- corrected = corrected.replace(/<think>[\s\S]*?<\/think>/gi, "").trim();
1271
+ // Strip a <think> trace if `/no_think` wasn't honored: closed pairs, a template-opened
1272
+ // leading …</think>, and a trailing UNCLOSED <think> (truncated by max_tokens).
1273
+ corrected = corrected
1274
+ .replace(/<think>[\s\S]*?<\/think>/gi, "")
1275
+ .replace(/^[\s\S]*?<\/think>/i, "")
1276
+ .replace(/<think>[\s\S]*$/i, "")
1277
+ .trim();
1265
1278
  return normalizeCorrection(corrected, extractedText);
1266
1279
  }
1267
1280
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiens.nguyen/gonext-local-worker",
3
- "version": "1.0.220",
3
+ "version": "1.0.222",
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",