Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ venv/
# Node.js
node_modules/
edict/frontend/node_modules/
edict/frontend/dist/
*.tsbuildinfo

# Vite cache
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ docker compose up

#### 前置条件
- [OpenClaw](https://openclaw.ai) 已安装
- Python 3.9+
- Python 3.10+
- macOS / Linux

#### 安装
Expand Down
5 changes: 3 additions & 2 deletions scripts/run_loop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
export EDICT_HOME="${EDICT_HOME:-$(dirname "$SCRIPT_DIR")}"
PYTHON_BIN="${EDICT_PYTHON:-python3}"
INTERVAL="${1:-15}"
LOG="/tmp/sansheng_liubu_refresh.log"
PIDFILE="/tmp/sansheng_liubu_refresh.pid"
Expand Down Expand Up @@ -58,14 +59,14 @@ echo " 按 Ctrl+C 停止"
safe_run() {
local script="$1"
if command -v timeout &>/dev/null; then
timeout "$SCRIPT_TIMEOUT" python3 "$script" >> "$LOG" 2>&1 || {
timeout "$SCRIPT_TIMEOUT" "$PYTHON_BIN" "$script" >> "$LOG" 2>&1 || {
local rc=$?
if [[ $rc -eq 124 ]]; then
echo "$(date '+%H:%M:%S') [loop] ⚠️ 脚本超时(${SCRIPT_TIMEOUT}s): $script" >> "$LOG"
fi
}
else
python3 "$script" >> "$LOG" 2>&1 || true
"$PYTHON_BIN" "$script" >> "$LOG" 2>&1 || true
fi
}

Expand Down
27 changes: 22 additions & 5 deletions start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,27 @@ cd "$REPO_DIR"

RED='\033[0;31m'; GREEN='\033[0;32m'; YELLOW='\033[1;33m'; BLUE='\033[0;34m'; NC='\033[0m'

# 检查 Python
if ! command -v python3 &>/dev/null; then
echo -e "${RED}❌ 未找到 python3,请先安装 Python 3.9+${NC}"
resolve_python() {
local candidate version major minor
for candidate in "${EDICT_PYTHON:-}" python3.12 python3.11 python3.10 python3; do
[ -n "$candidate" ] || continue
command -v "$candidate" &>/dev/null || continue
version=$("$candidate" -c 'import sys; print(f"{sys.version_info[0]}.{sys.version_info[1]}")' 2>/dev/null) || continue
major=${version%%.*}
minor=${version#*.}
if [ "$major" -gt 3 ] || { [ "$major" -eq 3 ] && [ "$minor" -ge 10 ]; }; then
echo "$candidate"
return 0
fi
done
return 1
}

PYTHON_BIN=$(resolve_python) || {
echo -e "${RED}❌ 未找到可用的 Python 3.10+(当前项目实际需要 3.10+)${NC}"
exit 1
fi
}
export EDICT_PYTHON="$PYTHON_BIN"

# 确保 data 目录存在
mkdir -p "$REPO_DIR/data"
Expand Down Expand Up @@ -57,7 +73,8 @@ fi

# 启动看板服务器
echo -e "${GREEN}▶ 启动看板服务器...${NC}"
python3 dashboard/server.py &
echo -e "${GREEN} 使用 Python: ${PYTHON_BIN} ($($PYTHON_BIN --version 2>&1))${NC}"
"$PYTHON_BIN" dashboard/server.py &
SERVER_PID=$!

sleep 1
Expand Down