9393 SKIP_INSTALLATION=false
9494fi
9595
96+ # 检查并更新SANDBOX_NETWORK参数
97+ check_sandbox_network () {
98+ if [ -f " config/.env_sandbox_gateway" ]; then
99+ CURRENT_NETWORK=$( grep " ^SANDBOX_NETWORK=" config/.env_sandbox_gateway | cut -d' =' -f2)
100+ if [ " $CURRENT_NETWORK " != " magic-sandbox-network" ]; then
101+ bilingual " 检测到SANDBOX_NETWORK参数值不是magic-sandbox-network,正在更新..." " Detected SANDBOX_NETWORK value is not magic-sandbox-network, updating..."
102+ if [ " $( uname -s) " == " Darwin" ]; then
103+ # macOS version
104+ sed -i ' ' " s/^SANDBOX_NETWORK=.*/SANDBOX_NETWORK=magic-sandbox-network/" config/.env_sandbox_gateway
105+ else
106+ # Linux version
107+ sed -i " s/^SANDBOX_NETWORK=.*/SANDBOX_NETWORK=magic-sandbox-network/" config/.env_sandbox_gateway
108+ fi
109+ bilingual " 已更新SANDBOX_NETWORK参数值为magic-sandbox-network" " Updated SANDBOX_NETWORK value to magic-sandbox-network"
110+ fi
111+ fi
112+ }
113+
96114# Let the user choose the language only if not skipped
97115if [ " $SKIP_LANGUAGE_SELECTION " = " false" ]; then
98116 choose_language () {
@@ -540,6 +558,9 @@ show_help() {
540558
541559# Start services
542560start_services () {
561+ # 检查并更新SANDBOX_NETWORK参数
562+ check_sandbox_network
563+
543564 bilingual " 正在前台启动服务..." " Starting services in foreground..."
544565 if [ -f " bin/use_super_magic" ]; then
545566 # 直接使用profile参数启动
@@ -561,6 +582,9 @@ stop_services() {
561582
562583# Start services in background
563584start_daemon () {
585+ # 检查并更新SANDBOX_NETWORK参数
586+ check_sandbox_network
587+
564588 bilingual " 正在后台启动服务..." " Starting services in background..."
565589 if [ -f " bin/use_super_magic" ]; then
566590 docker compose --profile super-magic --profile magic-gateway --profile sandbox-gateway up -d
@@ -571,6 +595,9 @@ start_daemon() {
571595
572596# Restart services
573597restart_services () {
598+ # 检查并更新SANDBOX_NETWORK参数
599+ check_sandbox_network
600+
574601 bilingual " 正在重启服务..." " Restarting services..."
575602 if [ -f " bin/use_super_magic" ]; then
576603 docker compose --profile super-magic --profile magic-gateway --profile sandbox-gateway restart
@@ -593,6 +620,9 @@ show_logs() {
593620
594621# Start only Super Magic service
595622start_super_magic () {
623+ # 检查并更新SANDBOX_NETWORK参数
624+ check_sandbox_network
625+
596626 # Check if .env_super_magic exists
597627 if ! check_super_magic_env; then
598628 exit 1
@@ -617,6 +647,9 @@ start_super_magic() {
617647
618648# Start only Super Magic service in background
619649start_super_magic_daemon () {
650+ # 检查并更新SANDBOX_NETWORK参数
651+ check_sandbox_network
652+
620653 # Check if .env_super_magic exists
621654 if ! check_super_magic_env; then
622655 exit 1
0 commit comments