From 8ca332854ffe333b645f8bf83a4f4be7d3409c99 Mon Sep 17 00:00:00 2001 From: Hermes Agent Date: Mon, 24 Aug 2026 21:01:17 +1000 Subject: [PATCH] fix: let saved Ollama URL override environment fallback --- README.md | 2 +- dashboard/manifest.json | 2 +- dashboard/plugin_api.py | 14 ++++++++------ plugin.yaml | 2 +- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 4c2dd5f..bb90515 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ In Hermes Dashboard, open **Plugins**, choose **Install from repository**, enter The dashboard now includes a connection panel in the header. Enter an Ollama base URL, choose **Local** or **Remote**, and use **Test** before **Save**. Saved URLs are stored in Hermes plugin data with file permissions restricted to the Hermes account. Credential-bearing URLs are rejected. -The plugin probes the configured local endpoint and known Docker endpoints, and tests a configured remote endpoint. A successful connection reports the Ollama version and installed model count. The active local endpoint continues to drive chat, status, load, and runtime telemetry. +The plugin probes the configured local endpoint and known Docker endpoints, and tests a configured remote endpoint. A successful connection reports the Ollama version and installed model count. The active local endpoint continues to drive chat, status, load, and runtime telemetry. A URL saved from the dashboard takes precedence over the initial `OLLAMA_HOST` environment fallback, so the field can correct or replace an inherited container setting. When both local and remote endpoints are online, downloading or re-downloading a model opens a destination chooser. The selected target is recorded on the job and the pull is sent to that endpoint. Remote downloads do not alter the local installed-model inventory. diff --git a/dashboard/manifest.json b/dashboard/manifest.json index 01b5fe3..4237c43 100644 --- a/dashboard/manifest.json +++ b/dashboard/manifest.json @@ -3,7 +3,7 @@ "label": "Ollama Models", "description": "Inspect, manage, and chat with local Ollama models, including shared persistent conversations, performance metrics, images, PDFs, URLs, and live memory telemetry.", "icon": "Cpu", - "version": "1.5.5", + "version": "1.5.6", "tab": {"path": "/ollama-manager", "position": "after:models"}, "entry": "dist/index.js", "css": "dist/style.css", diff --git a/dashboard/plugin_api.py b/dashboard/plugin_api.py index 5cd7eb9..37140ef 100644 --- a/dashboard/plugin_api.py +++ b/dashboard/plugin_api.py @@ -305,11 +305,13 @@ def _write_connections(value: dict[str, str]) -> None: def _apply_saved_connection() -> None: global LOCAL_OLLAMA - if os.environ.get("OLLAMA_HOST", "").strip(): - return saved = _read_connections().get("active_url") if saved: LOCAL_OLLAMA = saved + return + configured = os.environ.get("OLLAMA_HOST", "").strip() + if configured: + LOCAL_OLLAMA = configured.rstrip("/") def _target_endpoint(target: str = "local") -> str: @@ -336,7 +338,7 @@ def _probe_endpoint(url: str, timeout: int = 5) -> dict[str, Any]: def _connection_snapshot() -> list[dict[str, Any]]: saved = _read_connections() - configured_local = os.environ.get("OLLAMA_HOST", "").strip() or saved.get("local_url") + configured_local = saved.get("local_url") or os.environ.get("OLLAMA_HOST", "").strip() candidates: list[tuple[str, str, str]] = [] if configured_local: candidates.append(("local", "Configured local endpoint", configured_local)) @@ -1475,7 +1477,7 @@ def chat(body: ChatRequest) -> dict[str, Any]: @router.get("/connections") def connections() -> dict[str, Any]: saved = _read_connections() - active = os.environ.get("OLLAMA_HOST", "").strip() or saved.get("active_url") or LOCAL_OLLAMA + active = saved.get("active_url") or os.environ.get("OLLAMA_HOST", "").strip() or LOCAL_OLLAMA return {"active_url": active, "connections": _connection_snapshot(), "containerized": _running_in_container()} @@ -1494,10 +1496,10 @@ def connections_configure(body: ConnectionRequest) -> dict[str, Any]: raise HTTPException(400, "Connection role must be local or remote") saved = _read_connections() saved[f"{role}_url"] = url - if role == "local" and not os.environ.get("OLLAMA_HOST", "").strip(): + if role == "local": saved["active_url"] = url _write_connections(saved) - if role == "local" and not os.environ.get("OLLAMA_HOST", "").strip(): + if role == "local": global LOCAL_OLLAMA LOCAL_OLLAMA = url result = _probe_endpoint(url, timeout=8) diff --git a/plugin.yaml b/plugin.yaml index 46632cf..e81d0c6 100644 --- a/plugin.yaml +++ b/plugin.yaml @@ -1,5 +1,5 @@ name: ollama-manager -version: 1.5.5 +version: 1.5.6 description: Native dashboard manager and chat interface for local Ollama models, attachments, URLs, shared persistent conversations, performance metrics, and live runtime telemetry. auto_install_dependencies: true python_dependencies: