Skip to content

Commit

Permalink
update run.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
6vision committed Sep 26, 2024
1 parent a9fdbc3 commit 76a8974
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,22 @@ run_project() {
sleep 2


nohup python3 "${BASE_DIR}/app.py" > "${BASE_DIR}/nohup.out" 2>&1 &
# 判断操作系统类型
OS_TYPE=$(uname)

if [[ "$OS_TYPE" == "Linux" ]]; then
# 在 Linux 上使用 setsid
setsid python3 "${BASE_DIR}/app.py" > "${BASE_DIR}/nohup.out" 2>&1 &
echo -e "${GREEN}🚀 正在启动 ChatGPT-on-WeChat (Linux)...${NC}"
elif [[ "$OS_TYPE" == "Darwin" ]]; then
# 在 macOS 上直接运行
python3 "${BASE_DIR}/app.py" > "${BASE_DIR}/nohup.out" 2>&1 &
echo -e "${GREEN}🚀 正在启动 ChatGPT-on-WeChat (macOS)...${NC}"
else
echo -e "${RED}❌ 错误:不支持的操作系统 ${OS_TYPE}${NC}"
exit 1
fi

echo -e "${GREEN}🚀 正在启动 ChatGPT-on-WeChat ...${NC}"
sleep 2
# 显示日志输出,供用户扫码
tail -n 30 -f "${BASE_DIR}/nohup.out"
Expand Down Expand Up @@ -176,4 +189,4 @@ case "$1" in
echo -e "${YELLOW}=========================================${NC}"
exit 1
;;
esac
esac

0 comments on commit 76a8974

Please sign in to comment.