feat: expose Ollama models in Hermes picker

This commit is contained in:
Hermes Agent
2026-08-25 19:17:59 +10:00
parent 73a38617e3
commit 20555c802a
6 changed files with 127 additions and 2 deletions
+1 -1
View File
@@ -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.10",
"version": "1.5.11",
"tab": {"path": "/ollama-manager", "position": "after:models"},
"entry": "dist/index.js",
"css": "dist/style.css",
+20
View File
@@ -4,6 +4,7 @@ from __future__ import annotations
import base64
import binascii
import io
import importlib.util
import ipaddress
import json
import mimetypes
@@ -311,6 +312,22 @@ def _write_connections(value: dict[str, str]) -> None:
pass
def _sync_native_ollama_providers(connections: dict[str, str] | None = None) -> None:
"""Keep Hermes' native model picker aligned with this plugin's endpoints."""
try:
helper_path = Path(__file__).resolve().parent.parent / "ollama_provider.py"
spec = importlib.util.spec_from_file_location("_ollama_manager_provider_sync", helper_path)
if spec is None or spec.loader is None:
return
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
module.sync_hermes_ollama_providers(connections)
except Exception:
# Provider synchronization must never make the Ollama dashboard route fail.
return
def _apply_saved_connection() -> None:
global LOCAL_OLLAMA
saved = _read_connections().get("active_url")
@@ -1511,6 +1528,7 @@ def connections_configure(body: ConnectionRequest) -> dict[str, Any]:
if role == "local":
saved["active_url"] = url
_write_connections(saved)
_sync_native_ollama_providers(saved)
if role == "local":
global LOCAL_OLLAMA
LOCAL_OLLAMA = url
@@ -1533,6 +1551,7 @@ def connections_delete(role: str) -> dict[str, Any]:
if role == "local":
saved["active_url"] = ""
_write_connections(saved)
_sync_native_ollama_providers(saved)
if role == "local":
_apply_saved_connection()
return {"ok": True, "role": role, "removed_url": removed, "message": f"Removed saved {role} Ollama endpoint"}
@@ -1687,4 +1706,5 @@ def delete_model(body: ModelRequest) -> dict[str, Any]:
def create_ollama_routes(app) -> None:
_sync_native_ollama_providers()
app.include_router(router, prefix="/api/plugins/ollama-manager")