@tiens.nguyen/gonext-local-worker 1.0.17 → 1.0.19
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.
- package/gonext-local-worker.mjs +17 -2
- package/package.json +1 -1
package/gonext-local-worker.mjs
CHANGED
|
@@ -101,6 +101,11 @@ if (!apiBase || !workerKey) {
|
|
|
101
101
|
process.exit(1);
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
+
const CHUNK_PATH = "/api/worker/job-chunk";
|
|
105
|
+
console.log(
|
|
106
|
+
`[gonext-worker] API base ${apiBase} — streaming chunks POST ${apiBase}${CHUNK_PATH}`
|
|
107
|
+
);
|
|
108
|
+
|
|
104
109
|
function toOpenAIMessages(messages) {
|
|
105
110
|
return (Array.isArray(messages) ? messages : []).map((m) => {
|
|
106
111
|
if (m.role === "user" && m.attachments?.length) {
|
|
@@ -160,12 +165,22 @@ async function runChatJob(job) {
|
|
|
160
165
|
const t = buf;
|
|
161
166
|
buf = "";
|
|
162
167
|
if (!t) return;
|
|
163
|
-
const res = await workerFetch(
|
|
168
|
+
const res = await workerFetch(CHUNK_PATH, {
|
|
164
169
|
method: "POST",
|
|
165
170
|
body: JSON.stringify({ jobId, text: t }),
|
|
166
171
|
});
|
|
167
172
|
if (!res.ok && res.status !== 204) {
|
|
168
|
-
|
|
173
|
+
const snippet = (await res.text().catch(() => "")).trim().slice(0, 400);
|
|
174
|
+
const url = `${apiBase}${CHUNK_PATH}`;
|
|
175
|
+
console.error(
|
|
176
|
+
`[gonext-worker] job-chunk POST failed status=${res.status} url=${url} jobId=${jobId}` +
|
|
177
|
+
(snippet ? ` response=${snippet}` : "")
|
|
178
|
+
);
|
|
179
|
+
if (res.status === 404) {
|
|
180
|
+
console.error(
|
|
181
|
+
"[gonext-worker] hint: 404 usually means (a) API not redeployed with POST /api/worker/job-chunk, or (b) response JSON {\"error\":\"Job not found\"} = Dynamo lookup failed (wrong worker key user vs job owner)."
|
|
182
|
+
);
|
|
183
|
+
}
|
|
169
184
|
}
|
|
170
185
|
};
|
|
171
186
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiens.nguyen/gonext-local-worker",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.19",
|
|
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",
|