dcfede7e69
Paket B des Plans. AnythingLLM war nur ein Fallback-Chat zu Hermes; ersetzt durch das echte interaktive Agent-Terminal (`hermes chat`, mit Tools/PC) als eingebettetes Web-Terminal. Box: ttyd (apt) wrappt `hermes chat`; systemd-User-Unit deploy/hermes-terminal.service (LAN-Bind eno1:7681, apt-Default-ttyd-Dienst deaktiviert). In deploy.sh verankert. Backend: config HERMES_TERMINAL_URL statt ANYTHINGLLM_URL/_REPO; agent_status liefert terminal_url/terminal_reachable; maintenance ohne _anythingllm_update; system.py Dienst-Liste zeigt "Hermes-Terminal". Frontend: neue Terminal-Seite (iframe auf ttyd) + Nav-Tab; AgentView/AgentStatusCard/nav/api auf Terminal umgestellt; SystemDrawer toter hermes-dashboard raus, hermes-webui -> hermes-terminal; Guide-Texte aktualisiert. Cleanup: deploy/hermes-webui.service + deploy/lobechat/ entfernt (LobeChat-Migration hinfaellig), HERMES_WEBUI_URL-Env raus. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
80 lines
4.7 KiB
Python
80 lines
4.7 KiB
Python
"""
|
|
Zentrale Konfiguration für Mission Control 2.0.
|
|
|
|
Eine Quelle der Wahrheit für Pfade, URLs und Defaults — alles über Env-Vars
|
|
überschreibbar. Bewusst schlank: MC 2.0 ist ein Glue-Cockpit, das vorhandene
|
|
Dienste (llama-swap, LiteLLM-Gateway, Hermes) steuert, statt sie nachzubauen.
|
|
"""
|
|
|
|
import os
|
|
from pathlib import Path
|
|
|
|
from ruamel.yaml import YAML
|
|
|
|
# --- Engine (llama-swap) -----------------------------------------------------
|
|
LLAMA_SWAP_URL = os.environ.get("MC_LLAMA_SWAP_URL", "http://127.0.0.1:8080").rstrip("/")
|
|
CONFIG_PATH = Path(os.environ.get("MC_CONFIG_PATH", "/etc/llama-swap/config.yaml"))
|
|
MODELS_DIR = Path(os.environ.get("MC_MODELS_DIR", "/srv/models"))
|
|
# Cache der Modell-Entdeckung ("aktuell beste Modelle", live von HuggingFace).
|
|
# Persistent neben den Modellen (übersteht Deploys). TTL = Frische-Fenster.
|
|
DISCOVER_CACHE_PATH = Path(os.environ.get("MC_DISCOVER_CACHE", str(MODELS_DIR / "mc2-discover.json")))
|
|
DISCOVER_TTL = int(os.environ.get("MC_DISCOVER_TTL", "43200")) # 12 h
|
|
# Geteiltes Gedächtnis (SQLite, WAL). Persistent neben den Modellen.
|
|
MEMORY_DB = Path(os.environ.get("MC_MEMORY_DB", str(MODELS_DIR / "mc2-memory.db")))
|
|
# Befehl-Vorlage für llama-swap: {model}=GGUF-Pfad, {ctx}=Kontext, ${PORT} bleibt stehen.
|
|
# Hinweis: --prompt-cache/--prompt-cache-all sind llama-CLI-Flags, NICHT llama-server —
|
|
# llama-server lehnt sie ab ("invalid argument") und startet dann nicht. Prompt-Caching
|
|
# macht llama-server ohnehin automatisch pro Slot (KV-Reuse).
|
|
_DEFAULT_CMD_TEMPLATE = (
|
|
"llama-server -m {model} --host 127.0.0.1 --port ${PORT} "
|
|
"-c {ctx} -ngl 999 -fa 1 --no-mmap"
|
|
)
|
|
CMD_TEMPLATE = os.environ.get("MC_CMD_TEMPLATE", _DEFAULT_CMD_TEMPLATE)
|
|
if "{model}" not in CMD_TEMPLATE:
|
|
CMD_TEMPLATE = _DEFAULT_CMD_TEMPLATE
|
|
DEFAULT_TTL = int(os.environ.get("MC_DEFAULT_TTL", "300"))
|
|
# Verzeichnis mit Draft-Modellen für Speculative Decoding. Beim Hinzufügen eines
|
|
# fast/coder-Modells wird hieraus automatisch ein **vocab-kompatibler** Draft gewählt
|
|
# (Vocab-Check via services.gguf_meta; ein inkompatibler Draft lässt llama.cpp scheitern).
|
|
DRAFTS_DIR = Path(os.environ.get("MC_DRAFTS_DIR", str(MODELS_DIR / "drafts")))
|
|
# Optionaler expliziter Default-Draft (leer = Auto-Erkennung aus DRAFTS_DIR). Wird nur
|
|
# verwendet, wenn er zum Ziel-Modell vocab-kompatibel ist. (Früher fix qwen2.5 → entfernt,
|
|
# weil das mit neueren Vocabs wie Qwen3.6 inkompatibel ist und Spec stillschweigend brach.)
|
|
SPEC_DRAFT_MODEL_PATH = os.environ.get("MC_SPEC_DRAFT_MODEL", "")
|
|
# Speculative-Decoding-Typ (llama.cpp dieser Generation braucht --spec-type zusätzlich
|
|
# zu --spec-draft-model, sonst ist Spec inaktiv).
|
|
SPEC_TYPE = os.environ.get("MC_SPEC_TYPE", "draft-simple")
|
|
# Env für HuggingFace-Downloads: XET deaktivieren (Hänger bei ~6 MB, siehe v1-Gotcha).
|
|
HF_DOWNLOAD_ENV = {"HF_HUB_DISABLE_XET": "1"}
|
|
|
|
# --- Routing-Gateway (builtin in MC2, model: auto) ---------------------------
|
|
# MC2 IST der Gateway (services/gateway.py + routers/gateway_proxy.py). KEIN externer
|
|
# LiteLLM-Dienst (scheitert auf Python 3.14). Daher keine Gateway-Config-Datei mehr.
|
|
GATEWAY_URL = os.environ.get("MC_GATEWAY_URL", f"http://127.0.0.1:{os.environ.get('MC_PORT', '9000')}").rstrip("/")
|
|
|
|
# --- Hermes Agent (eigener Dienst auf der Box) -------------------------------
|
|
# Gateway (OpenAI-API des Agenten) + interaktives Web-Terminal (ttyd → `hermes chat`).
|
|
HERMES_API_URL = os.environ.get("HERMES_API_URL", "http://127.0.0.1:8642").rstrip("/")
|
|
# Hermes-Terminal: ttyd-Web-Terminal der interaktiven Agent-CLI (Ersatz für AnythingLLM-Chat).
|
|
# Wird in MC2 per iframe eingebettet (Terminal-Seite). Siehe deploy/hermes-terminal.service.
|
|
HERMES_TERMINAL_URL = os.environ.get("MC_HERMES_TERMINAL_URL", "http://192.168.178.151:7681").rstrip("/")
|
|
# GitHub-Repo für Update-Checks.
|
|
HERMES_AGENT_REPO = os.environ.get("MC_HERMES_AGENT_REPO", "NousResearch/hermes-agent")
|
|
HERMES_HOME = Path(os.path.expanduser(os.environ.get("HERMES_HOME", "~/.hermes")))
|
|
# PC Executor — läuft auf dem Windows-PC, erreichbar über LAN.
|
|
PC_EXECUTOR_URL = os.environ.get("MC_PC_EXECUTOR_URL", "http://192.168.178.98:7777").rstrip("/")
|
|
|
|
# --- Server ------------------------------------------------------------------
|
|
HOST = os.environ.get("MC_HOST", "0.0.0.0")
|
|
PORT = int(os.environ.get("MC_PORT", "9000"))
|
|
# Gebautes React-Frontend (frontend/dist). In Prod liefert FastAPI es statisch aus;
|
|
# im Dev läuft der Vite-Dev-Server separat und proxyt /api hierher.
|
|
FRONTEND_DIST = Path(os.environ.get("MC_FRONTEND_DIST", str(Path(__file__).resolve().parent.parent / "frontend" / "dist")))
|
|
|
|
# Version (Phase 0 — Greenfield-Skeleton).
|
|
VERSION = "2.0.0-w8"
|
|
|
|
# Gemeinsame YAML-Instanz (preserve_quotes hält Kommentare/Quotes in config.yaml).
|
|
yaml = YAML()
|
|
yaml.preserve_quotes = True
|