Backend: Box-Sync + Drift-Fixes (Review P0-3)

- deploy/llama-swap.config.yaml: Live-Box-Config jetzt versioniert (war untracked + veraltet)
- config.py: Template -fa 1 -> -fa on (Box-Standard)
- llamaswap.py: cache-reuse NICHT bei mmproj-Modellen anhaengen (verifizierte Vision-Falle)
- voice.py: Thinking-Deaktivierung fuer Voice-Chat (MC_VOICE_NO_THINK)
- connect.py: IDE-Snippets zeigen nur noch die coding-Lane

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Hitonabi
2026-07-02 10:29:01 +02:00
parent 3c0a24feb7
commit 9967155332
5 changed files with 75 additions and 12 deletions
+10 -10
View File
@@ -15,9 +15,9 @@ from config import LLAMA_SWAP_URL, MEM0_SERVICE_URL, PORT
DEFAULT_HOST = "192.168.178.151"
# Modelle/Lanes, die der Gateway anbietet. Lanes zuerst: 'coding' (agentischer Coder) ist der
# Standard für IDEs, 'chat' für Allgemeines; dahinter die direkten Aliase.
GATEWAY_MODELS = ["coding", "chat", "fast", "heavy", "coder", "vision"]
# IDEs bekommen NUR die 'coding'-Lane zu sehen — die Lane routet intern selbst auf das
# passende Modell (Coder/Heavy/…). Ein einziger Eintrag, kein manuelles Modell-Wählen mehr.
IDE_MODEL = "coding"
def _gw(host: str) -> str:
@@ -44,7 +44,7 @@ def build_snippets(host: str = DEFAULT_HOST,
"npm": "@ai-sdk/openai-compatible",
"name": "Bosgame Gateway",
"options": {"baseURL": gw, "apiKey": "local"},
"models": {m: {"name": m} for m in GATEWAY_MODELS},
"models": {IDE_MODEL: {"name": IDE_MODEL}},
}
}
}, indent=2)
@@ -61,8 +61,8 @@ def build_snippets(host: str = DEFAULT_HOST,
"bosgame": {
"api_url": gw,
"available_models": [
{"name": m, "display_name": m, "max_tokens": 131072,
"capabilities": {"tools": True}} for m in GATEWAY_MODELS
{"name": IDE_MODEL, "display_name": IDE_MODEL, "max_tokens": 131072,
"capabilities": {"tools": True}}
],
}
}
@@ -70,15 +70,15 @@ def build_snippets(host: str = DEFAULT_HOST,
"assistant": {
"default_model": {
"provider": "openai_compatible",
"model": "coding"
"model": IDE_MODEL
}
}
}, indent=2)
cont = json.dumps({
"models": [
{"title": f"Bosgame / {m}", "provider": "openai", "model": m,
"apiBase": gw, "apiKey": "local"} for m in ("coding", "chat", "coder")
{"title": f"Bosgame / {IDE_MODEL}", "provider": "openai", "model": IDE_MODEL,
"apiBase": gw, "apiKey": "local"}
]
}, indent=2)
@@ -115,7 +115,7 @@ def build_snippets(host: str = DEFAULT_HOST,
# Leitung 1 — das MODELL. Alle Snippets zeigen auf den OpenAI-kompatiblen Gateway.
"tools": {
"cline": {"label": "Roo Code / Cline", "lang": "json", "snippet": cline,
"note": "OpenAI-Provider → Gateway. Lane 'coding' (agentischer Coder); 'chat' für Allgemeines."},
"note": "OpenAI-Provider → Gateway. Nur Lane 'coding' — die Box routet intern selbst."},
"cursor": {"label": "Cursor", "lang": "json", "snippet": cursor,
"note": "Einstellungen ➔ Models ➔ OpenAI API key + Base URL."},
"opencode": {"label": "OpenCode", "lang": "jsonc", "snippet": opencode,
+3 -1
View File
@@ -221,7 +221,9 @@ def register_model(model_path: str, role: str | None = None, ctx: int = 8192,
# KV-Cache-Reuse über Turns (Prompt-Cache wiederverwenden) — hilft allen Chat-Modellen
# (Agent-Hirn, Coding, Multi-Turn). Spiegelt die auf der Box bewährten Flags wider, damit
# neu installierte Modelle nicht hinter dem hand-getunten Stand zurückbleiben (Drift-Fix).
if "--cache-reuse" not in cmd:
# NICHT bei Vision-Modellen: --cache-reuse + --mmproj bricht llama-server (live verifiziert,
# deshalb fahren vision/scout auf der Box ohne cache-reuse).
if "--cache-reuse" not in cmd and "--mmproj" not in cmd:
cmd += " --cache-reuse 256 -cram 16384"
# IDE-Coding profitiert von Nebenläufigkeit; sonst Default 1 Slot = voller Kontext/Anfrage
# (--parallel teilt den Kontext HART auf die Slots auf, s. docs/OPTIMIZATION_PLAN.md §9.4 V6).