@tiens.nguyen/gonext-local-worker 1.0.132 → 1.0.134
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 +20 -1
- package/package.json +1 -1
package/gonext_agent_chat.py
CHANGED
|
@@ -66,6 +66,22 @@ def _http_request_impl(method, url, headers=None, body=None, timeout=25):
|
|
|
66
66
|
return f"Error: {e}"
|
|
67
67
|
|
|
68
68
|
|
|
69
|
+
def _normalize_openai_base(url: str) -> str:
|
|
70
|
+
"""Normalize a model-server URL to its OpenAI-compatible /v1 root.
|
|
71
|
+
|
|
72
|
+
Users paste whatever their server docs show: an MLX root (http://host:8089), an
|
|
73
|
+
Ollama native endpoint (http://host:11434/api/generate), or a full /v1 URL. Ollama
|
|
74
|
+
serves the OpenAI-compatible API at /v1 on the same host, so strip any native
|
|
75
|
+
/api/... path (including a mistakenly appended /v1 after it) and ensure /v1.
|
|
76
|
+
"""
|
|
77
|
+
u = (url or "").strip().rstrip("/")
|
|
78
|
+
if not u:
|
|
79
|
+
return ""
|
|
80
|
+
u = re.sub(r"/api(/(generate|chat|tags|embeddings|embed))?(/v1)?$", "", u,
|
|
81
|
+
flags=re.IGNORECASE)
|
|
82
|
+
return u if u.lower().endswith("/v1") else u + "/v1"
|
|
83
|
+
|
|
84
|
+
|
|
69
85
|
def _html_to_text(html_text, limit=3000):
|
|
70
86
|
"""Strip HTML to readable plain text (zero-dep). Used by fetch_url so the weak
|
|
71
87
|
model receives prose instead of raw tags it cannot parse."""
|
|
@@ -934,7 +950,10 @@ def run_agent_chat(cfg):
|
|
|
934
950
|
# Optional dedicated coding/reasoning model for the CodeAgent's tool-use loop.
|
|
935
951
|
# Routing, plain replies and summarization stay on the chat model (better at
|
|
936
952
|
# natural language); the code model only drives http_request reasoning.
|
|
937
|
-
|
|
953
|
+
# The URL may be a pasted Ollama endpoint (http://host:11434/api/generate) or a
|
|
954
|
+
# bare host — normalize to the OpenAI-compatible /v1 root either way (defensive:
|
|
955
|
+
# also fixes an older API layer that appended /v1 after the native /api path).
|
|
956
|
+
raw_coding_base = _normalize_openai_base(cfg.get("codingBaseURL") or "")
|
|
938
957
|
raw_coding_model = (cfg.get("codingModelId") or "").strip()
|
|
939
958
|
if raw_coding_base:
|
|
940
959
|
same_server = raw_coding_base.rstrip("/") == (agent_base_url or "").rstrip("/")
|
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.134",
|
|
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",
|