@tiens.nguyen/gonext-local-worker 1.0.25 → 1.0.29
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 +29 -0
- package/package.json +1 -1
package/gonext-local-worker.mjs
CHANGED
|
@@ -29,10 +29,12 @@ gonext-local-worker
|
|
|
29
29
|
Usage:
|
|
30
30
|
gonext-local-worker
|
|
31
31
|
gonext-local-worker set <workerKey> [--api-base <url>] [--poll-ms <ms>]
|
|
32
|
+
gonext-local-worker ws-ping-test # POST /api/worker/ws-ping-test (needs GONEXT_* env)
|
|
32
33
|
|
|
33
34
|
Examples:
|
|
34
35
|
gonext-local-worker set abc123 --api-base https://hwohu56e8d.execute-api.ap-southeast-1.amazonaws.com
|
|
35
36
|
gonext-local-worker
|
|
37
|
+
gonext-local-worker ws-ping-test
|
|
36
38
|
|
|
37
39
|
Env (optional):
|
|
38
40
|
GONEXT_MLX_LM_PYTHON Python executable for MLX LM native probe (default: python3)
|
|
@@ -94,6 +96,31 @@ const apiBase = (process.env.GONEXT_API_BASE ?? "").replace(/\/+$/, "");
|
|
|
94
96
|
const workerKey = process.env.GONEXT_WORKER_KEY ?? "";
|
|
95
97
|
const pollMs = Number(process.env.GONEXT_POLL_MS ?? "1500") || 1500;
|
|
96
98
|
|
|
99
|
+
if (args[0] === "ws-ping-test") {
|
|
100
|
+
if (!apiBase || !workerKey) {
|
|
101
|
+
console.error(
|
|
102
|
+
"ws-ping-test needs GONEXT_API_BASE and GONEXT_WORKER_KEY (run: gonext-local-worker set <key> --api-base <url>)"
|
|
103
|
+
);
|
|
104
|
+
process.exit(1);
|
|
105
|
+
}
|
|
106
|
+
const url = `${apiBase}/api/worker/ws-ping-test`;
|
|
107
|
+
const res = await fetch(url, {
|
|
108
|
+
method: "POST",
|
|
109
|
+
headers: {
|
|
110
|
+
"Content-Type": "application/json",
|
|
111
|
+
"X-Worker-Key": workerKey,
|
|
112
|
+
},
|
|
113
|
+
body: "{}",
|
|
114
|
+
});
|
|
115
|
+
const text = await res.text();
|
|
116
|
+
if (!res.ok) {
|
|
117
|
+
console.error(`[gonext-worker] ws-ping-test failed ${res.status}: ${text}`);
|
|
118
|
+
process.exit(1);
|
|
119
|
+
}
|
|
120
|
+
console.log("[gonext-worker] ws-ping-test OK:", text);
|
|
121
|
+
process.exit(0);
|
|
122
|
+
}
|
|
123
|
+
|
|
97
124
|
if (!apiBase || !workerKey) {
|
|
98
125
|
console.error(
|
|
99
126
|
"Set GONEXT_API_BASE (HTTP API origin, no /api suffix) and GONEXT_WORKER_KEY."
|
|
@@ -154,6 +181,8 @@ async function runChatJob(job) {
|
|
|
154
181
|
const client = new OpenAI({
|
|
155
182
|
baseURL: payload.baseURL,
|
|
156
183
|
apiKey: payload.apiKey || "ollama",
|
|
184
|
+
maxRetries: 0,
|
|
185
|
+
timeout: 90_000,
|
|
157
186
|
});
|
|
158
187
|
|
|
159
188
|
let buf = "";
|
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.29",
|
|
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",
|