refactor: architektur-optimierungen (systemd, jq, httpx, commit-hook)
This commit is contained in:
@@ -39,7 +39,6 @@ Begleiterin „Lucy".
|
|||||||
- Doku-Drift möglich: `AGENTS.md` nennt „Box läuft in UTC" — die Box wurde inzwischen auf
|
- Doku-Drift möglich: `AGENTS.md` nennt „Box läuft in UTC" — die Box wurde inzwischen auf
|
||||||
`Europe/Berlin` umgestellt.
|
`Europe/Berlin` umgestellt.
|
||||||
- Alte, disabled v1-System-Unit `mission-control.service` liegt kosmetisch herum (sudo zum Entfernen).
|
- 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.
|
- Ein paar frühere Frontend-Monolithen wurden entflochten; Rest-Altlasten möglich.
|
||||||
|
|
||||||
## Was NICHT empfohlen werden soll (bereits entschieden)
|
## Was NICHT empfohlen werden soll (bereits entschieden)
|
||||||
|
|||||||
+1
-1
@@ -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).
|
# pro /v1-Anfrage (spart Sockets/TIME_WAIT unter parallelen Agent-Strömen von Zed/Kilo).
|
||||||
app.state.gw_client = httpx.AsyncClient(
|
app.state.gw_client = httpx.AsyncClient(
|
||||||
timeout=httpx.Timeout(connect=10.0, read=None, write=None, pool=10.0),
|
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:
|
try:
|
||||||
yield
|
yield
|
||||||
|
|||||||
Executable
+26
@@ -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 "$@"
|
||||||
@@ -14,6 +14,7 @@ Wants=network-online.target
|
|||||||
Type=simple
|
Type=simple
|
||||||
WorkingDirectory=%h/mission-control-v2/backend
|
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
|
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_PORT=9001
|
||||||
Environment=MC_LLAMA_SWAP_URL=http://127.0.0.1:8080
|
Environment=MC_LLAMA_SWAP_URL=http://127.0.0.1:8080
|
||||||
Environment=MC_CONFIG_PATH=/etc/llama-swap/config.yaml
|
Environment=MC_CONFIG_PATH=/etc/llama-swap/config.yaml
|
||||||
|
|||||||
+2
-2
@@ -65,8 +65,8 @@ case "$ROLE" in
|
|||||||
*) SYS="${WORKER_SYS:-$BUILD_SYS}" ;;
|
*) SYS="${WORKER_SYS:-$BUILD_SYS}" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
RESP="$(jq -n --arg m "$MODEL" --arg s "$SYS" --arg u "$TASK" --argjson t "$MAXTOK" --argjson temp "$TEMP" \
|
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:$u}]}' \
|
'{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)"
|
| 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)"
|
OUT="$(printf '%s' "$RESP" | jq -r '.choices[0].message.content // empty' 2>/dev/null)"
|
||||||
|
|||||||
Reference in New Issue
Block a user