From 6bb62904e096f5c24b7911d560a9d9f1b64a81db Mon Sep 17 00:00:00 2001 From: wangbo Date: Sat, 4 Apr 2026 23:01:43 +0800 Subject: [PATCH] =?UTF-8?q?fix(config):=20=E6=9B=B4=E6=96=B0=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E5=90=8D=E7=A7=B0=E5=92=8C=E9=85=8D=E7=BD=AE=E6=A3=80?= =?UTF-8?q?=E6=B5=8B=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将 comfy-server 替换为 easyai-server 在环境配置文件中 - 修改 README.md 中的服务引用名称 - 添加 WS_GATEWAY_LOG_LEVEL 日志级别配置 - 实现 nginx 配置文件自动检测和选择功能 - 更新 https.sh 中的配置文件查找逻辑 --- .env.AMS.sample | 2 +- .env.ASG.sample | 6 +++--- .env.sample | 2 ++ README.md | 8 +++---- docker-compose.yml | 1 + https.sh | 52 +++++++++++++++++++++++++++++++++++++++++----- 6 files changed, 58 insertions(+), 13 deletions(-) diff --git a/.env.AMS.sample b/.env.AMS.sample index 79e9736..409b816 100644 --- a/.env.AMS.sample +++ b/.env.AMS.sample @@ -7,7 +7,7 @@ # ---------- 主服务连接(用于 Embedding 与对话压缩)---------- # 主服务 API 地址(容器内网地址) -MEMORY_AI_BASE_URL=http://comfy-server:3001 +MEMORY_AI_BASE_URL=http://easyai-server:3001 MEMORY_AI_API_KEY= # 默认模型配置接口路径已内置为 /content/llm/default-models,无需额外环境变量 diff --git a/.env.ASG.sample b/.env.ASG.sample index c77a677..411636c 100644 --- a/.env.ASG.sample +++ b/.env.ASG.sample @@ -21,13 +21,13 @@ ASG_REDIS_DB=8 # ---------- 服务端口 ---------- # HTTP API 端口 ASG_PORT=3003 -# TCP 微服务端口(供 comfy-server 内部调用) +# TCP 微服务端口(供 easyai-server 内部调用) ASG_TCP_PORT=4003 ASG_TCP_HOST=0.0.0.0 # ---------- 主服务连接 ---------- -# Agent 调用时需要访问的 comfy-server 地址(容器内网地址) -ASG_MAIN_BACKEND_URL=http://comfy-server:3001 +# Agent 调用时需要访问的 easyai-server 地址(容器内网地址) +ASG_MAIN_BACKEND_URL=http://easyai-server:3001 # 管理员账号(用于 Agent 登录获取 token) ASG_ADMIN_USERNAME=admin ASG_ADMIN_PASSWORD=123456 diff --git a/.env.sample b/.env.sample index 6c56005..0c89f7d 100644 --- a/.env.sample +++ b/.env.sample @@ -89,6 +89,8 @@ CONFIG_PROXY_URL= # 连接 GPT 等外部服务时设置 LOG_LEVEL=log,error,warn,debug +# WS 网关专用日志级别(默认生产不输出 debug) +WS_GATEWAY_LOG_LEVEL=log,error,warn DOZZLE_PORT=8080 WATCHTOWER_PORT=8089 diff --git a/README.md b/README.md index 5df2606..62628a2 100644 --- a/README.md +++ b/README.md @@ -96,7 +96,7 @@ Windows 下使用 `update.ps1`,功能与 Linux 版一致: 1. **新增 Agent 记忆服务(AMS)模块**:新增 `agent-memory`(Agent 长期记忆)容器,复用 `easyai-pgvector` 数据库(需 pgvector 扩展),用于支持 Agent 对话记忆、向量召回与反馈能力。 2. **新增环境变量文件**:新增 `.env.AMS.sample` 文件,包含记忆服务所需的全部环境变量。 -3. 主服务 `comfy-server` 新增 `MEMORY_TCP_HOST` 和 `MEMORY_TCP_PORT` 环境变量,用于内部 TCP 微服务通信。 +3. 主服务 `easyai-server` 新增 `MEMORY_TCP_HOST` 和 `MEMORY_TCP_PORT` 环境变量,用于内部 TCP 微服务通信。 4. **Nginx 代理**:`easyai-proxy.conf.sample` 中新增 `/ams-api/` 路径代理(可选)。 #### 升级步骤 @@ -123,7 +123,7 @@ cp .env.AMS.sample .env.AMS MEMORY_DATABASE_URL=postgresql://easyai:easyai2025@easyai-pgvector:5432/easyai_memory?schema=public # 主服务 API 地址(用于 Embedding 与对话压缩) -MEMORY_AI_BASE_URL=http://comfy-server:3001 +MEMORY_AI_BASE_URL=http://easyai-server:3001 # Embedding 模型与维度(需与主服务一致) MEMORY_EMBEDDING_DIMENSION=1024 @@ -188,7 +188,7 @@ curl https://<你的域名>/ams-api/health 1. **新增 Agent 服务治理(ASG)模块**:新增 `easyai-asg`(Agent 服务治理)容器和独立的 `easyai-pgvector`(PostgreSQL 18)数据库容器,用于支持 Agent 自动化治理能力。 2. **新增 Nginx 反向代理**:在 `easyai-proxy.conf.sample` 中新增 `/asg-api/` 路径代理,用于暴露 ASG 服务的 REST API。 3. **新增环境变量文件**:新增 `.env.ASG.sample` 文件,包含 ASG 服务所需的全部环境变量。 -4. 主服务 `comfy-server` 新增 `ASG_TCP_HOST` 和 `ASG_TCP_PORT` 环境变量,用于内部 TCP 微服务通信。 +4. 主服务 `easyai-server` 新增 `ASG_TCP_HOST` 和 `ASG_TCP_PORT` 环境变量,用于内部 TCP 微服务通信。 5. **前端新增环境变量**:`.env` 中新增 `NUXT_PUBLIC_SG_APIURL`,用于前端治理管理页面调用 ASG API。 #### 升级步骤 @@ -231,7 +231,7 @@ ASG_REDIS_HOST=redis ASG_REDIS_PASSWORD= # 与主服务 Redis 密码保持一致 # 主服务连接地址(容器内网地址) -ASG_MAIN_BACKEND_URL=http://comfy-server:3001 +ASG_MAIN_BACKEND_URL=http://easyai-server:3001 # 管理员账号(用于 Agent 调用时登录获取 token) ASG_ADMIN_USERNAME=admin ASG_ADMIN_PASSWORD=123456 diff --git a/docker-compose.yml b/docker-compose.yml index 5a1b4da..83a759a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -146,6 +146,7 @@ services: - CONFIG_COMFYUI_QUENE_REDIS_PASSWORD= #日志与调试 - LOG_LEVEL=${LOG_LEVEL} + - WS_GATEWAY_LOG_LEVEL=${WS_GATEWAY_LOG_LEVEL} #MQ - CONFIG_MQ_USER=${CONFIG_MQ_USER} - CONFIG_MQ_PASSWORD=${CONFIG_MQ_PASSWORD} diff --git a/https.sh b/https.sh index 09af646..9042673 100755 --- a/https.sh +++ b/https.sh @@ -251,13 +251,56 @@ upsert_domain_for_conf() { fi } +detect_existing_proxy_conf() { + local preferred_file=$1 + local -a candidates=() + local conf + + if [ -n "$preferred_file" ] && [ -f "./$preferred_file" ]; then + echo "$preferred_file" + return 0 + fi + + while IFS= read -r conf; do + if grep -Eq "^[[:space:]]*server_name[[:space:]]+" "./$conf"; then + candidates+=("$conf") + fi + done < <(ls -1 *.conf 2>/dev/null || true) + + if [ "${#candidates[@]}" -eq 0 ]; then + return 1 + fi + + if [ "${#candidates[@]}" -eq 1 ]; then + echo "${candidates[0]}" + return 0 + fi + + echo "⚠️ 检测到多个可用配置文件,请选择一个:" + local i + for i in "${!candidates[@]}"; do + printf " %s) %s\n" "$((i + 1))" "${candidates[$i]}" + done + while true; do + read -r -p "请输入序号: " i + if [[ "$i" =~ ^[0-9]+$ ]] && [ "$i" -ge 1 ] && [ "$i" -le "${#candidates[@]}" ]; then + echo "${candidates[$((i - 1))]}" + return 0 + fi + echo "❌ 无效序号,请重新输入。" + done +} + echo "🚀 复制当前目录的配置文件到nginx配置文件目录" # 支持 EASYAI_PROXY_CONF 指定配置文件(如 51easyai.com.conf) -CONF_FILE="${EASYAI_PROXY_CONF:-easyai-proxy.conf}" -if [ -f "./$CONF_FILE" ]; then +PREFERRED_CONF_FILE="${EASYAI_PROXY_CONF:-}" +DEFAULT_NEW_CONF_FILE="${EASYAI_PROXY_CONF:-easyai-proxy.conf}" +CONF_FILE=$(detect_existing_proxy_conf "$PREFERRED_CONF_FILE") +if [ -n "$CONF_FILE" ]; then upsert_domain_for_conf "$CONF_FILE" else - echo "ℹ️ 当前目录未找到配置文件 ./$CONF_FILE" + CONF_FILE="$DEFAULT_NEW_CONF_FILE" + echo "ℹ️ 当前目录未找到可用 nginx 配置文件(*.conf 且包含 server_name)" input_domain=$(prompt_domain) create_conf_by_template "$input_domain" "$CONF_FILE" echo "✅ 已根据域名 $input_domain 创建配置文件: ./$CONF_FILE" @@ -272,12 +315,11 @@ sudo nginx -s stop echo "🚀 使用certbot 自动配置证书" # 从 Nginx 配置文件中提取所有域名 -CONF_FILE="${EASYAI_PROXY_CONF:-easyai-proxy.conf}" SERVER_NAME_LINES=$( if [ -f "/etc/nginx/conf.d/$CONF_FILE" ]; then grep "server_name" "/etc/nginx/conf.d/$CONF_FILE" 2>/dev/null || true else - find /etc/nginx/conf.d/ -name "easyai-proxy.conf" -exec grep "server_name" {} \; 2>/dev/null || true + find /etc/nginx/conf.d/ -name "*.conf" -exec grep "server_name" {} \; 2>/dev/null || true fi )