- Chrome: --disable-blink-features=AutomationControlled (+ ko-KR) so Google shows results, not the /sorry/ automation block. - Settings persist to /data/jarvis-settings.json (survives recreate; entrypoint re-merges it) AND the runtime config; apply restarts via a DETACHED process so the HTTP response isn't dropped when the bridge restarts. - Bridge reads tts_engine from the settings config so the TTS-engine choice actually applies.
72 lines
3.1 KiB
Bash
Executable File
72 lines
3.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Container entrypoint: render config from env, set the VNC password, ensure the
|
|
# Piper voice exists, then hand off to supervisord (which runs the desktop,
|
|
# bridge, and bot).
|
|
set -euo pipefail
|
|
|
|
# --- Defaults (override via .env / compose) ---
|
|
: "${VNC_PASSWORD:=javis123}"
|
|
: "${VNC_RESOLUTION:=1920x1080}"
|
|
: "${OLLAMA_BASE_URL:=http://ollama:11434}"
|
|
: "${OLLAMA_CHAT_MODEL:=qwen3:8b}"
|
|
# Auxiliary small-model calls (intent judge, tool router, weather place
|
|
# extraction, query decomposition). The code default is gemma4:e2b, which this
|
|
# stack does not pull, so those calls would silently fail and fall open —
|
|
# crippling tool routing and arg extraction. Reuse the (already warm) chat model
|
|
# by default so everything runs on one resident model; override if you pull a
|
|
# dedicated small model.
|
|
: "${OLLAMA_INTENT_MODEL:=${OLLAMA_CHAT_MODEL}}"
|
|
: "${OLLAMA_EMBED_MODEL:=nomic-embed-text}"
|
|
: "${WHISPER_MODEL:=small}"
|
|
: "${WHISPER_DEVICE:=cuda}"
|
|
: "${WHISPER_COMPUTE_TYPE:=float16}"
|
|
: "${JARVIS_DB_PATH:=/data/jarvis.db}"
|
|
: "${BRIDGE_HOST:=127.0.0.1}"
|
|
: "${BRIDGE_PORT:=8765}"
|
|
: "${PIPER_VOICE:=en_GB-alan-medium}"
|
|
: "${PIPER_VOICE_DIR:=/opt/piper-voices}"
|
|
: "${TTS_PIPER_MODEL_PATH:=${PIPER_VOICE_DIR}/${PIPER_VOICE}.onnx}"
|
|
|
|
# Audio: shared PulseAudio socket so Chrome (playback) and the selfbot ffmpeg
|
|
# (capture of @DEFAULT_MONITOR@) reach the same headless daemon (run-pulse.sh).
|
|
: "${XDG_RUNTIME_DIR:=/run/user/0}"
|
|
: "${PULSE_SERVER:=unix:${XDG_RUNTIME_DIR}/pulse/native}"
|
|
|
|
export VNC_RESOLUTION OLLAMA_BASE_URL OLLAMA_CHAT_MODEL OLLAMA_INTENT_MODEL OLLAMA_EMBED_MODEL \
|
|
WHISPER_MODEL WHISPER_DEVICE WHISPER_COMPUTE_TYPE JARVIS_DB_PATH \
|
|
PIPER_VOICE PIPER_VOICE_DIR TTS_PIPER_MODEL_PATH BRIDGE_HOST BRIDGE_PORT \
|
|
XDG_RUNTIME_DIR PULSE_SERVER
|
|
|
|
mkdir -p /data /app/config "$(dirname "$JARVIS_DB_PATH")"
|
|
|
|
# --- VNC password file ---
|
|
mkdir -p /root/.vnc
|
|
echo "$VNC_PASSWORD" | tigervncpasswd -f > /root/.vnc/passwd
|
|
chmod 600 /root/.vnc/passwd
|
|
|
|
# --- Render jarvis brain config from template ---
|
|
envsubst < /app/docker/jarvis-config.template.json > /app/config/jarvis.json
|
|
export JARVIS_CONFIG_PATH=/app/config/jarvis.json
|
|
# Merge persistent settings from the settings UI (on the /data volume) on top of
|
|
# the env-rendered config, so changes survive container recreate.
|
|
if [ -f /data/jarvis-settings.json ]; then
|
|
python3 - <<'PY' || true
|
|
import json
|
|
try:
|
|
base = json.load(open("/app/config/jarvis.json"))
|
|
ov = json.load(open("/data/jarvis-settings.json"))
|
|
if isinstance(base, dict) and isinstance(ov, dict):
|
|
base.update(ov)
|
|
json.dump(base, open("/app/config/jarvis.json", "w"), ensure_ascii=False, indent=2)
|
|
print("[entrypoint] merged persistent settings overrides")
|
|
except Exception as e:
|
|
print(f"[entrypoint] settings merge skipped: {e}")
|
|
PY
|
|
fi
|
|
|
|
# --- Ensure the Piper voice exists (best effort) ---
|
|
bash /app/docker/download-piper.sh || echo "[entrypoint] piper download failed; TTS may be unavailable"
|
|
|
|
echo "[entrypoint] display=$DISPLAY ollama=$OLLAMA_BASE_URL whisper=$WHISPER_MODEL/$WHISPER_DEVICE"
|
|
exec supervisord -c /app/docker/supervisord.conf
|