Files
FishServer/fish_api/start_fresh.sh
2026-05-06 15:59:38 +08:00

38 lines
1.3 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# 默认**仅**重置 client_id 投递游标后启动 Fish APIuvicorn其余全部保留。
# SQLite 历史快照、measure_output、media预览视频、stream_tmp 均保留。
#
# bash fish_api/start_fresh.sh
# PORT=8001 HOST=0.0.0.0 bash fish_api/start_fresh.sh
#
# 强制清空 SQLite谨慎
# CLEAR_SQLITE_DATABASE=1 bash fish_api/start_fresh.sh
#
# 强制清空中间输出目录(重新生成点云等):
# CLEAR_MEASURE_OUTPUT=1 bash fish_api/start_fresh.sh
# CLEAR_MEASURE_OUTPUT=1 CLEAR_ACTION_OUTPUT=1 bash fish_api/start_fresh.sh
#
# 强制清空媒体/流临时目录:
# CLEAR_MEDIA=1 bash fish_api/start_fresh.sh
# CLEAR_STREAM_TMP=1 bash fish_api/start_fresh.sh
#
# 首次使用请先cd fish_api && python3 -m pip install -e .
#
set -euo pipefail
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$DIR"
# 勿在此默认导出 PUBLIC_BASE_URLshell 环境会覆盖 fish_api/.envpydantic 优先级)。
# 未设置时由 app/settings.py 的默认值或 .env 中的 PUBLIC_BASE_URL 决定。
unset PYTHON_FISH_MEASURE PYTHON_FISH_ACTION 2>/dev/null || true
PY="${PYTHON:-python3}"
"$PY" -m app.prestart_fresh
PORT="${PORT:-8000}"
HOST="${HOST:-0.0.0.0}"
exec uvicorn app.main:app --host "$HOST" --port "$PORT"