wrolpi/modules/ai/conftest.py
Roland c6e0f18d5e
ai: ai.yaml config, model catalog, and the GGUF downloader
ai.yaml is the source of truth (opt-in: enabled=False by default) with
active model, idle-unload minutes, context override, and tool-call
bound.  The model catalog follows the map pattern: a bundled constant
keeps the Manage tab working offline, the CDN manifest (ai/models.json
+ detached GPG signature) wins when reachable.  GGUF downloads clone
the map-extract flow — the per-file meta4 is GPG-verified once and the
same bytes handed to aria2c, so the verified hash is the enforced one;
unverified downloads are refused.  Models land in <media>/ai/models/
(gated by the existing media_mounted download rules).  Manage endpoints
(catalog with RAM-tier recommendation, settings) live under
/api/ai/manage/ which the future agent loop excludes from its tool
catalog.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-09-24 14:09:53 -06:00

17 lines
667 B
Python

# AI module test fixtures. The docs conftest is not star-imported by the root conftest, but the
# AI endpoints cover docs; import its fixtures so AI tests can use doc_factory.
import pytest
from modules.ai.config import ai_config_context
from modules.docs.conftest import * # noqa
from wrolpi.api_utils import api_app
@pytest.fixture
def test_ai_config(test_directory, async_client):
"""An isolated ai.yaml config for one test."""
(test_directory / 'config').mkdir(exist_ok=True)
config_path = test_directory / 'config/ai.yaml'
with ai_config_context() as config:
config.initialize(api_app.shared_ctx.ai_config)
yield config_path