From 2afe93e1a169a4535d2a51e5839f3ed3f9aac50c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 8 Mar 2026 14:28:10 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=9B=A2=E9=98=9F=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=20+=20API=E4=BB=A3=E7=90=86=E9=83=A8?= =?UTF-8?q?=E7=BD=B2=20+=20128k=E4=B8=8A=E4=B8=8B=E6=96=87=EF=BC=88?= =?UTF-8?q?=E6=97=A0=E9=9C=80API=E5=AF=86=E9=92=A5=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: qinfendebingshuo <207279273+qinfendebingshuo@users.noreply.github.com> --- .github/workflows/deploy-to-server.yml | 51 ++++++- docs/index.html | 188 ++++++++++++++++++++++--- 2 files changed, 219 insertions(+), 20 deletions(-) diff --git a/.github/workflows/deploy-to-server.yml b/.github/workflows/deploy-to-server.yml index dd8ef35f..ec372b94 100644 --- a/.github/workflows/deploy-to-server.yml +++ b/.github/workflows/deploy-to-server.yml @@ -210,6 +210,25 @@ jobs: exit 0 fi + # 部署 API 代理服务(AI 聊天代理,端口 3721) + if [ -f '${{ secrets.DEPLOY_PATH }}/backend-integration/api-proxy.js' ]; then + echo '📦 安装 API 代理依赖...' + cd '${{ secrets.DEPLOY_PATH }}/backend-integration' + npm install --production 2>/dev/null || echo '⚠️ api-proxy npm install 失败(可能无 package.json,继续)' + echo '🔄 重启 API 代理服务...' + pm2 restart guanghulab-proxy 2>/dev/null || \ + YUNWU_API_KEY='${{ secrets.YUNWU_API_KEY }}' \ + DEEPSEEK_API_KEY='${{ secrets.YUNWU_API_KEY }}' \ + pm2 start api-proxy.js --name guanghulab-proxy \ + --env YUNWU_API_KEY='${{ secrets.YUNWU_API_KEY }}' \ + --env DEEPSEEK_API_KEY='${{ secrets.YUNWU_API_KEY }}' \ + 2>/dev/null || \ + echo '⚠️ API 代理 pm2 启动失败' + # 更新环境变量(如果进程已存在) + pm2 env guanghulab-proxy 2>/dev/null && \ + pm2 restart guanghulab-proxy --update-env 2>/dev/null || true + fi + # 部署 backend 服务(Express API,端口 3000) if [ -f '${{ secrets.DEPLOY_PATH }}/backend/server.js' ]; then echo '📦 安装 backend 依赖...' @@ -287,7 +306,37 @@ jobs: printf '%s\n' \ '# guanghulab 反向代理(由 CD 工作流自动生成)' \ '' \ - '# API 反向代理 → Express 后端端口 3000' \ + '# AI 聊天 API 代理 → api-proxy.js 端口 3721(SSE 流式支持)' \ + 'location /api/chat {' \ + ' proxy_pass http://127.0.0.1:3721/api/chat;' \ + ' proxy_http_version 1.1;' \ + ' proxy_set_header Host \$host;' \ + ' proxy_set_header X-Real-IP \$remote_addr;' \ + ' proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;' \ + ' proxy_set_header X-Forwarded-Proto \$scheme;' \ + ' proxy_set_header Connection "";' \ + ' proxy_buffering off;' \ + ' proxy_cache off;' \ + ' chunked_transfer_encoding on;' \ + ' proxy_read_timeout 90s;' \ + ' proxy_send_timeout 60s;' \ + '}' \ + '' \ + 'location /api/models {' \ + ' proxy_pass http://127.0.0.1:3721/api/models;' \ + ' proxy_http_version 1.1;' \ + ' proxy_set_header Host \$host;' \ + ' proxy_set_header X-Real-IP \$remote_addr;' \ + '}' \ + '' \ + 'location /api/health {' \ + ' proxy_pass http://127.0.0.1:3721/api/health;' \ + ' proxy_http_version 1.1;' \ + ' proxy_set_header Host \$host;' \ + ' proxy_set_header X-Real-IP \$remote_addr;' \ + '}' \ + '' \ + '# 其他 API → Express 后端端口 3000' \ 'location /api/ {' \ ' proxy_pass http://127.0.0.1:3000/api/;' \ ' proxy_http_version 1.1;' \ diff --git a/docs/index.html b/docs/index.html index a33bfcfe..392f13f3 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,5 +1,5 @@ - +
@@ -339,12 +339,41 @@ footer{padding:12px 18px 16px;padding-bottom:max(16px,env(safe-area-inset-bottomHoloLake · 铸渊(Zhùyuān)· 代码守护人格体
找冰朔或肥猫获取团队 Key 和端点地址,输入后点「🔍 检测模型」即可使用。
+选择「🏠 团队登录」→ 选择你的开发者编号 → 直接进入对话。无需 API 密钥,系统使用服务器端代理。
登录页选择「👤 访客模式」进入演示,可查看团队进度面板(🦁 指挥台),AI 回答功能受限。
+登录页选择「👤 访客模式」进入体验,可查看团队进度面板(🦁 指挥台),AI 回答功能受限。
'+meta.devId+'' : '')
+ + '