feat: add serve.sh and serve.cmd startup scripts for Scene Skill Generator

🤖 Generated with [Qoder][https://qoder.com]
This commit is contained in:
木炎
2026-04-16 22:25:34 +08:00
parent d00086a70b
commit 6c1865eb1c
2 changed files with 63 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
@echo off
setlocal
set PORT=%1
if "%PORT%"=="" set PORT=3210
set SG_SCENE_GENERATOR_PORT=%PORT%
echo.
echo +==================================================+
echo ^| sgClaw Scene Skill Generator ^|
echo +==================================================+
echo ^| ^|
echo ^| 访问地址: http://127.0.0.1:%PORT%/ ^|
echo ^| ^|
echo ^| 按 Ctrl+C 停止服务 ^|
echo +==================================================+
echo.
cd /d "%~dp0"
node server.js

View File

@@ -0,0 +1,44 @@
#!/bin/bash
# ============================================================
# sgClaw Scene Skill Generator — HTTP 服务启动脚本
#
# 用法:
# ./serve.sh # 默认 3210 端口
# ./serve.sh 9090 # 指定端口
# ============================================================
set -e
PORT="${1:-3210}"
DIR="$(cd "$(dirname "$0")" && pwd)"
cd "$DIR"
get_ip() {
ip -4 addr show 2>/dev/null \
| grep -oP 'inet \K[\d.]+' \
| grep -v '127.0.0.1' \
| head -1
}
LOCAL_IP=$(get_ip)
if [ -z "$LOCAL_IP" ]; then
LOCAL_IP=$(hostname -I 2>/dev/null | awk '{print $1}')
fi
if [ -z "$LOCAL_IP" ]; then
LOCAL_IP="<本机IP>"
fi
echo ""
echo " ╔══════════════════════════════════════════════════╗"
echo " ║ sgClaw · Scene Skill Generator ║"
echo " ╠══════════════════════════════════════════════════╣"
echo " ║ ║"
echo " ║ 本机访问: http://127.0.0.1:${PORT}/ ║"
echo " ║ 局域网访问: http://${LOCAL_IP}:${PORT}/ ║"
echo " ║ ║"
echo " ║ 按 Ctrl+C 停止服务 ║"
echo " ╚══════════════════════════════════════════════════╝"
echo ""
export SG_SCENE_GENERATOR_PORT="$PORT"
node server.js