@tiens.nguyen/gonext-local-worker 1.0.67 → 1.0.68
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_agent_chat.py +14 -9
- package/package.json +1 -1
package/gonext_agent_chat.py
CHANGED
|
@@ -244,14 +244,16 @@ def run_agent_chat(cfg):
|
|
|
244
244
|
# and always terminate with final_answer() rather than looping forever.
|
|
245
245
|
tool_hint = (
|
|
246
246
|
"You have ONE built-in function: `http_request(method, url, headers='', body='')`. "
|
|
247
|
-
"It returns a plain STRING
|
|
248
|
-
"
|
|
249
|
-
"
|
|
247
|
+
"It returns a plain STRING — NOT a dict. Never use response['key'] or response.get().\n"
|
|
248
|
+
"The string is either 'HTTP <status>\\n<body>' on success, or 'Error: ...' on failure.\n"
|
|
249
|
+
"Always check for errors first:\n"
|
|
250
250
|
" import json\n"
|
|
251
|
-
"
|
|
252
|
-
"
|
|
253
|
-
"
|
|
254
|
-
"
|
|
251
|
+
" if response.startswith('Error:'):\n"
|
|
252
|
+
" final_answer(f'The request failed: {response}')\n"
|
|
253
|
+
" else:\n"
|
|
254
|
+
" lines = response.split('\\n', 1)\n"
|
|
255
|
+
" data = json.loads(lines[1]) if len(lines) > 1 else {}\n"
|
|
256
|
+
" final_answer(f'The API returned HTTP {lines[0].split()[1]}: {data}')\n\n"
|
|
255
257
|
)
|
|
256
258
|
task_with_hint = tool_hint + "Task: " + task_text
|
|
257
259
|
|
|
@@ -271,9 +273,12 @@ def run_agent_chat(cfg):
|
|
|
271
273
|
parsed_headers = json.loads(headers)
|
|
272
274
|
except Exception: # noqa: BLE001
|
|
273
275
|
pass
|
|
276
|
+
# Retry once on timeout — gorok tunnels can be flaky on the first attempt.
|
|
274
277
|
result = _http_request_impl(method, url, parsed_headers, body or None)
|
|
275
|
-
|
|
276
|
-
|
|
278
|
+
if result.startswith("Error:"):
|
|
279
|
+
_log(f"http_request retry {method.upper()} {url}")
|
|
280
|
+
_emit({"type": "step", "text": f"HTTP {method.upper()} {url} → timeout, retrying…"})
|
|
281
|
+
result = _http_request_impl(method, url, parsed_headers, body or None)
|
|
277
282
|
status_line = result.split("\n")[0][:150] if result else "no response"
|
|
278
283
|
_emit({"type": "step", "text": f"HTTP {method.upper()} {url} → {status_line}"})
|
|
279
284
|
_log(f"http_request {method.upper()} {url} → {result[:80]}")
|
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.68",
|
|
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",
|