diff --git a/SAVEPOINT.md b/SAVEPOINT.md index be1d010..354a3e8 100644 --- a/SAVEPOINT.md +++ b/SAVEPOINT.md @@ -39,7 +39,6 @@ Begleiterin „Lucy". - Doku-Drift möglich: `AGENTS.md` nennt „Box läuft in UTC" — die Box wurde inzwischen auf `Europe/Berlin` umgestellt. - Alte, disabled v1-System-Unit `mission-control.service` liegt kosmetisch herum (sudo zum Entfernen). -- Ältere Review-Notiz nannte toten Code-Verdacht (`pricing.py`, `token_stats.py`) — bitte prüfen. - Ein paar frühere Frontend-Monolithen wurden entflochten; Rest-Altlasten möglich. ## Was NICHT empfohlen werden soll (bereits entschieden) diff --git a/backend/app.py b/backend/app.py index b643b99..5869488 100644 --- a/backend/app.py +++ b/backend/app.py @@ -72,7 +72,7 @@ async def lifespan(app: FastAPI) -> AsyncGenerator[None, None]: # pro /v1-Anfrage (spart Sockets/TIME_WAIT unter parallelen Agent-Strömen von Zed/Kilo). app.state.gw_client = httpx.AsyncClient( timeout=httpx.Timeout(connect=10.0, read=None, write=None, pool=10.0), - limits=httpx.Limits(max_keepalive_connections=32, max_connections=64), + limits=httpx.Limits(max_keepalive_connections=100, max_connections=200), ) try: yield diff --git a/deploy/commit.sh b/deploy/commit.sh new file mode 100755 index 0000000..d73a0b9 --- /dev/null +++ b/deploy/commit.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +# Wrapper fuer "git commit", der das Frontend automatisch baut, wenn Dateien geaendert wurden. +# Benutzung: ./deploy/commit.sh -m "deine commit message" + +set -euo pipefail + +# In das Projekt-Root wechseln +cd "$(dirname "$0")/.." + +FRONTEND_DIR="frontend" + +# Pruefen, ob Dateien im Frontend-Ordner fuer den Commit vorgemerkt (staged) sind, +# die einen Build erfordern (src, index.html, package.json, etc.). +if git diff --cached --name-only | grep -q "^$FRONTEND_DIR/src/\|^$FRONTEND_DIR/index.html\|^$FRONTEND_DIR/package.json\|^$FRONTEND_DIR/vite.config.ts"; then + echo "=== Frontend-Aenderungen in der Stage entdeckt. Starte Build... ===" + (cd "$FRONTEND_DIR" && npm run build) + + # Das neu gebaute dist-Verzeichnis direkt mit stagen + git add "$FRONTEND_DIR/dist" + echo "=== Build abgeschlossen und frontend/dist gestaged. ===" +else + echo "=== Keine Frontend-Aenderungen in der Stage. Ueberspringe Build. ===" +fi + +# Führe den eigentlichen Commit mit den übergebenen Parametern durch +exec git commit "$@" diff --git a/deploy/mission-control-2.service b/deploy/mission-control-2.service index c8e5528..e1bf86c 100644 --- a/deploy/mission-control-2.service +++ b/deploy/mission-control-2.service @@ -14,6 +14,7 @@ Wants=network-online.target Type=simple WorkingDirectory=%h/mission-control-v2/backend ExecStart=%h/mission-control-v2/backend/.venv/bin/python -m uvicorn app:app --host 0.0.0.0 --port 9001 +Environment=PYTHONPATH=%h/mission-control-v2 Environment=MC_PORT=9001 Environment=MC_LLAMA_SWAP_URL=http://127.0.0.1:8080 Environment=MC_CONFIG_PATH=/etc/llama-swap/config.yaml diff --git a/deploy/worker.sh b/deploy/worker.sh index 550ce00..ea3ffbd 100644 --- a/deploy/worker.sh +++ b/deploy/worker.sh @@ -65,8 +65,8 @@ case "$ROLE" in *) SYS="${WORKER_SYS:-$BUILD_SYS}" ;; esac -RESP="$(jq -n --arg m "$MODEL" --arg s "$SYS" --arg u "$TASK" --argjson t "$MAXTOK" --argjson temp "$TEMP" \ - '{model:$m, temperature:$temp, max_tokens:$t, messages:[{role:"system",content:$s},{role:"user",content:$u}]}' \ +RESP="$(printf '%s' "$TASK" | jq -Rs . | jq -n --arg m "$MODEL" --arg s "$SYS" --argjson t "$MAXTOK" --argjson temp "$TEMP" \ + '{model:$m, temperature:$temp, max_tokens:$t, messages:[{role:"system",content:$s},{role:"user",content:input}]}' \ | curl -s --max-time 300 "$ENDPOINT" -H 'Content-Type: application/json' -d @- 2>/dev/null)" OUT="$(printf '%s' "$RESP" | jq -r '.choices[0].message.content // empty' 2>/dev/null)"