diff --git a/apps/web/vue3/index.html b/apps/web/vue3/index.html
index c1acbfe65..5281b307c 100644
--- a/apps/web/vue3/index.html
+++ b/apps/web/vue3/index.html
@@ -1365,6 +1365,7 @@
拓展分析阶段
+ 运行结果
已写阶段
@@ -1425,7 +1426,6 @@
运行已发布
- 运行结果
diff --git a/manage_plantai.sh b/manage_plantai.sh
index cbb9b7e19..52b893ae5 100755
--- a/manage_plantai.sh
+++ b/manage_plantai.sh
@@ -1,22 +1,46 @@
#!/bin/bash
# PlantAI-dev 9000 服务管理脚本
-# 用法: bash manage_plantai.sh {start|stop|restart|status}
+# 用法: bash manage_plantai.sh {start|stop|restart|status} [--port PORT]
+# 默认端口: 9000
#
# 项目: /home/xzq/5090/teamWorkspace/zh/PlantAI-dev
# 端口: 9000 (web), Redis DB 14 (queue prefix: plantai_dev_9002)
set -euo pipefail
+# 解析命令行参数:第一个参数是命令,后面可选 --port / -p
+CMD=""
+WEB_PORT="9000"
+for arg in "$@"; do
+ case "$arg" in
+ start|stop|restart|status)
+ CMD="$arg"
+ ;;
+ --port|-p)
+ WEB_PORT=""
+ ;;
+ *)
+ if [ -z "$WEB_PORT" ] && [[ "$arg" =~ ^[0-9]+$ ]]; then
+ WEB_PORT="$arg"
+ elif [ -z "$CMD" ]; then
+ echo "错误: 未知命令 '$arg'"
+ echo "用法: bash manage_plantai.sh {start|stop|restart|status} [--port PORT]"
+ exit 1
+ fi
+ ;;
+ esac
+done
+CMD="${CMD:-status}"
+
# Conda 环境:启动脚本内部也依赖这个环境
CONDA_ENV="${CONDA_ENV:-/home/xzq/miniconda3/envs/test4py311}"
export PATH="$CONDA_ENV/bin:$PATH"
# 项目配置(与 .env 和启动脚本保持一致)
PROJECT_DIR="/home/xzq/5090/teamWorkspace/zh/PlantAI-dev"
-WEB_PORT="9000"
QUEUE_PREFIX="plantai_dev_9002"
-WEB_LOG="/tmp/plantai_9000.log"
-CELERY_LOG="/tmp/celery_9000.log"
+WEB_LOG="/tmp/plantai_${WEB_PORT}.log"
+CELERY_LOG="/tmp/celery_${WEB_PORT}.log"
red() { echo -e "\033[31m$*\033[0m"; }
green(){ echo -e "\033[32m$*\033[0m"; }
@@ -24,7 +48,7 @@ cyan() { echo -e "\033[36m$*\033[0m"; }
status() {
echo ""
- cyan "=== PlantAI-dev 9000 服务状态 ==="
+ cyan "=== PlantAI-dev ${WEB_PORT} 服务状态 ==="
echo ""
# Web 服务
@@ -58,7 +82,7 @@ status() {
stop() {
echo ""
- cyan "=== 停止 PlantAI-dev 9000 服务 ==="
+ cyan "=== 停止 PlantAI-dev ${WEB_PORT} 服务 ==="
echo ""
# 停止 Web 服务
@@ -97,7 +121,7 @@ stop() {
start() {
echo ""
- cyan "=== 启动 PlantAI-dev 9000 服务 ==="
+ cyan "=== 启动 PlantAI-dev ${WEB_PORT} 服务 ==="
echo ""
# 检查是否已在运行
@@ -126,7 +150,7 @@ start() {
# 启动 Web 服务
echo "正在启动 Web 服务..."
- nohup bash start_plantai_9000.sh > "$WEB_LOG" 2>&1 &
+ nohup bash start_plantai_9000.sh --port "$WEB_PORT" > "$WEB_LOG" 2>&1 &
sleep 3
if ss -tlnp 2>/dev/null | grep -q ":$WEB_PORT"; then
green " [✓] Web 服务已启动 (http://0.0.0.0:$WEB_PORT)"
@@ -139,7 +163,7 @@ start() {
echo "日志文件:"
echo " Web: $WEB_LOG"
echo " Celery: $CELERY_LOG"
- echo " Worker: $PROJECT_DIR/logs/celery_plantai_dev_9000/"
+ echo " Worker: $PROJECT_DIR/logs/celery_${QUEUE_PREFIX}/"
echo ""
}
@@ -149,13 +173,13 @@ restart() {
start
}
-case "${1:-status}" in
+case "$CMD" in
start) start ;;
stop) stop ;;
restart) restart ;;
status) status ;;
*)
- echo "用法: bash manage_plantai.sh {start|stop|restart|status}"
+ echo "用法: bash manage_plantai.sh {start|stop|restart|status} [--port PORT]"
exit 1
;;
esac
diff --git a/restart_plantai_9000.sh b/restart_plantai_9000.sh
new file mode 100755
index 000000000..06e7bab13
--- /dev/null
+++ b/restart_plantai_9000.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+# Project restart script — called by /api/admin/restart-project
+# 用法: bash restart_plantai_9000.sh [--port PORT]
+# 从环境变量 PLANTAI_WEB_PORT 或参数获取端口,默认 9000
+
+set -euo pipefail
+
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+
+PORT="${PLANTAI_WEB_PORT:-9000}"
+while [[ $# -gt 0 ]]; do
+ case "$1" in
+ --port|-p)
+ PORT="${2:?错误: --port 需要指定端口号}"
+ shift 2
+ ;;
+ *)
+ shift
+ ;;
+ esac
+done
+
+cd "$SCRIPT_DIR"
+exec bash manage_plantai.sh restart --port "$PORT"
diff --git a/start_plantai_9000.sh b/start_plantai_9000.sh
index ab815fdb5..93050a096 100755
--- a/start_plantai_9000.sh
+++ b/start_plantai_9000.sh
@@ -1,8 +1,26 @@
#!/bin/bash
-# Start the PlantAI-dev web service on port 9000.
+# Start the PlantAI-dev web service.
+# 用法: bash start_plantai_9000.sh [--port PORT]
+# 默认端口: 9000
set -euo pipefail
+# 解析命令行参数
+PORT="9000"
+while [[ $# -gt 0 ]]; do
+ case "$1" in
+ --port|-p)
+ PORT="${2:?错误: --port 需要指定端口号}"
+ shift 2
+ ;;
+ *)
+ echo "未知参数: $1"
+ echo "用法: bash start_plantai_9000.sh [--port PORT]"
+ exit 1
+ ;;
+ esac
+done
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
@@ -26,7 +44,8 @@ export BBAV5_LIGHTWEIGHT_INPUT="${BBAV5_LIGHTWEIGHT_INPUT:-$SCRIPT_DIR/input}"
export BBAV5_LIGHTWEIGHT_WORKSPACE="${BBAV5_LIGHTWEIGHT_WORKSPACE:-$SCRIPT_DIR/workspace}"
export BBAV5_QUEUE_PREFIX="${BBAV5_QUEUE_PREFIX:-plantai_dev_9000}"
export BBAV5_REDIS_URL="${BBAV5_REDIS_URL:-redis://localhost:6379/10}"
-export PLANTAI_WEB_PORT="9000"
+export PLANTAI_WEB_PORT="$PORT"
+export PLANTAI_RESTART_SCRIPT="$SCRIPT_DIR/restart_plantai_9000.sh"
export GENE_FAMILY_MAS_API="http://127.0.0.1:7926"
export DUAL_KB_QA_BASE_URL="http://127.0.0.1:7926"
export RAG_API_URL="http://127.0.0.1:7926/api/v1/qa-v1-1-73/chat"