Files
gpu-rent/tests/test_doctor_llm.py
Leonid PershinandCursor 03ba4cb6ed Seed Assistent personas as overlay folders and tighten Ollama/Assistent glue.
gpu-rent now writes personas/<id>/ on the VM (not legacy personas.json), adds seed-personas/doctor checks, and shortens mid/high keep-alive now that Assistent parks the LLM before Generate.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-22 01:00:14 +03:00

62 lines
1.9 KiB
Python

"""Doctor LLM / Assistent local checks."""
from __future__ import annotations
from pathlib import Path
from gpu_rent.doctor import Check, _llm_assistent
class _Cfg:
llm_runtime = "ollama"
ollama_models_manifest = None
extensions_manifest = None
def test_llm_assistent_warns_without_ollama_yaml(tmp_path: Path, monkeypatch):
cfg = _Cfg()
cfg.ollama_models_manifest = tmp_path / "missing-ollama.yaml"
cfg.extensions_manifest = tmp_path / "extensions.yaml"
cfg.extensions_manifest.write_text(
"swarmui:\n"
" - url: https://gitea.example/swarm-assistent.git\n"
" dir: swarm-assistent\n"
" requires: ollama\n",
encoding="utf-8",
)
monkeypatch.setattr(
"gpu_rent.paths.ollama_models_manifest_path",
lambda: cfg.ollama_models_manifest,
)
checks: list[Check] = []
_llm_assistent(cfg, checks)
names = {c.name: c for c in checks}
assert names["ollama-models.yaml"].ok is False
assert names["ollama-models.yaml"].blocking is True
assert names["Assistent ext"].ok is True
def test_llm_assistent_ok_with_manifests(tmp_path: Path, monkeypatch):
ollama = tmp_path / "ollama-models.yaml"
ollama.write_text(
"models:\n - name: foo:7b\n use: chat\n default: true\n",
encoding="utf-8",
)
ext = tmp_path / "extensions.yaml"
ext.write_text(
"swarmui:\n"
" - url: https://gitea.example/swarm-assistent.git\n"
" dir: swarm-assistent\n"
" requires: ollama\n",
encoding="utf-8",
)
cfg = _Cfg()
cfg.ollama_models_manifest = ollama
cfg.extensions_manifest = ext
cfg.llm_runtime = "ollama"
checks: list[Check] = []
_llm_assistent(cfg, checks)
by = {c.name: c for c in checks}
assert by["ollama-models.yaml"].ok
assert "swarm-assistent" in by["Assistent ext"].detail