Files
zk-data-agent/scripts/start-backend.sh
T
2026-05-07 11:50:50 +08:00

35 lines
1003 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
# Ubuntu/systemd 后端启动入口。
# 配置从项目根目录的 .env.deploy 读取;该文件只保存在部署机器本地,不提交到 git。
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
ENV_FILE="${ROOT_DIR}/.env.deploy"
if [[ -f "${ENV_FILE}" ]]; then
# shellcheck disable=SC1090
source "${ENV_FILE}"
else
echo "Missing deploy config: ${ENV_FILE}" >&2
echo "Run: bash scripts/deploy-ubuntu.sh" >&2
exit 1
fi
export OPENAI_API_KEY
export OPENAI_BASE_URL="${OPENAI_BASE_URL:-http://model.mify.ai.srv/v1}"
export OPENAI_MODEL="${OPENAI_MODEL:-xiaomi/mimo-v2-flash}"
BACKEND_HOST="${CLAW_BACKEND_HOST:-127.0.0.1}"
BACKEND_PORT="${CLAW_BACKEND_PORT:-8765}"
PYTHON_BIN="${CLAW_PYTHON_BIN:-${ROOT_DIR}/.venv/bin/python}"
exec "${PYTHON_BIN}" -m src.gui \
--host "${BACKEND_HOST}" \
--port "${BACKEND_PORT}" \
--cwd "${ROOT_DIR}" \
--session-dir "${ROOT_DIR}/.port_sessions/agent" \
--allow-write \
--allow-shell \
--no-browser