feat(aihr): scope supervisor practice data

This commit is contained in:
2026-07-09 11:37:33 +08:00
parent 53698e7832
commit a83fb53ecd
11 changed files with 406 additions and 31 deletions
+87 -6
View File
@@ -75,8 +75,77 @@ stop_port() {
kill -9 $pids >/dev/null 2>&1 || true
}
stop_portless_route() {
local name="$1"
local pids
if ! command -v portless >/dev/null 2>&1; then
return
fi
pids="$(portless list 2>/dev/null | sed -nE "s#.*https://${name}[.]localhost.*[(]pid ([0-9]+)[)].*#\\1#p" || true)"
if [[ -z "$pids" ]]; then
echo "Portless route $name is not running."
return
fi
echo "Stopping portless route $name: $pids"
kill $pids >/dev/null 2>&1 || true
for _ in {1..20}; do
if ! portless list 2>/dev/null | grep -q "https://${name}[.]localhost"; then
return
fi
sleep 0.2
done
kill -9 $pids >/dev/null 2>&1 || true
}
stop_launchctl_job() {
local label="$1"
local domain="gui/$(id -u)/$label"
if ! command -v launchctl >/dev/null 2>&1; then
return
fi
if ! launchctl print "$domain" >/dev/null 2>&1; then
return
fi
echo "Stopping launchctl job $label"
launchctl bootout "$domain" >/dev/null 2>&1 || true
}
using_portless() {
[[ "${PORTLESS:-1}" != "0" ]] && command -v portless >/dev/null 2>&1
}
using_portless_backend() {
using_portless
}
using_portless_admin() {
using_portless
}
backend_url() {
if using_portless_backend; then
echo "https://wygj-api.localhost/"
else
echo "http://127.0.0.1:8080/"
fi
}
admin_url() {
if using_portless_admin; then
echo "https://wygj-admin.localhost/"
else
echo "http://127.0.0.1:5173/"
fi
}
stop_dev() {
stop_launchctl_job local.wygj.backend.dev
stop_portless_route wygj-api
stop_port 8080
stop_portless_route wygj-admin
stop_port 5173
stop_port 5174
}
@@ -86,6 +155,9 @@ status() {
lsof -nP -iTCP:8080 -sTCP:LISTEN || true
lsof -nP -iTCP:5173 -sTCP:LISTEN || true
lsof -nP -iTCP:5174 -sTCP:LISTEN || true
if command -v portless >/dev/null 2>&1; then
portless list || true
fi
}
if [[ "${1:-}" == "--help" || "${1:-}" == "-h" ]]; then
@@ -125,8 +197,12 @@ esac
cd "$ROOT_DIR"
ensure_docker
ensure_port_free 8080
ensure_port_free 5173
if ! using_portless_backend; then
ensure_port_free 8080
fi
if ! using_portless_admin; then
ensure_port_free 5173
fi
ensure_port_free 5174
if [[ "$RESET" == true ]]; then
@@ -137,7 +213,12 @@ fi
trap cleanup INT TERM EXIT
./scripts/dev-backend.sh &
if using_portless_backend; then
portless alias --remove wygj-api >/dev/null 2>&1 || true
portless run --name wygj-api ./scripts/dev-backend.sh &
else
./scripts/dev-backend.sh &
fi
PIDS+=("$!")
./scripts/dev-frontend.sh &
@@ -146,10 +227,10 @@ PIDS+=("$!")
./scripts/dev-mobile.sh &
PIDS+=("$!")
echo "Backend: http://127.0.0.1:8080/"
echo "Admin: http://127.0.0.1:5173/"
echo "Backend: $(backend_url)"
echo "Admin: $(admin_url)"
echo "Legacy mobile fallback: http://127.0.0.1:5174/h5/user"
echo "Current user side: https://wygj-mobile-uni.localhost/h5/ (run: portless)"
echo "Current user side: https://wygj-mobile-uni.localhost/h5/ (run: cd mobile-uni && portless run --name wygj-mobile-uni npm run dev)"
echo "Qdrant: http://127.0.0.1:6333/"
echo "Press Ctrl+C to stop backend, admin frontend and legacy mobile frontend."