diff --git a/.env.pcb.example b/.env.pcb.example index 6b8fa78..69d0f17 100644 --- a/.env.pcb.example +++ b/.env.pcb.example @@ -1,6 +1,6 @@ # Copy to .env.local. Real provider keys NEVER belong in VITE_* or Git. # Persistent Codex PCB session backend. Override when using a remote installation. -PCB_API_TARGET=http://127.0.0.1:8003 +PCB_API_TARGET=http://39.105.93.138:8003 PCB_API_ORIGIN=http://127.0.0.1:5173 # Account and platform project API, independent of the AI task service: API_TARGET=https://dev-vibemake-api.robotquan.com diff --git a/CODEX-SESSION.md b/CODEX-SESSION.md index 4df0cdc..a41bac5 100644 --- a/CODEX-SESSION.md +++ b/CODEX-SESSION.md @@ -45,7 +45,7 @@ journalctl --user -u vibemake-pcb2-session.service -f curl http://127.0.0.1:8003/api/health ``` -The root `start.sh --services` starts the new systemd services on a configured Linux server. Without this flag, `start.sh` builds/serves the frontend and proxies its API to the separately running backend (default `127.0.0.1:8003`). All requests are asynchronous and the UI polls task state/events. The service binds loopback; the web proxy retains its same-origin write checks. +The root `start.sh --services` starts the new systemd services on a configured Linux server. Without this flag, `start.sh` builds/serves the frontend and proxies its API to the separately running backend (default `http://39.105.93.138:8003`, overridable with `PCB_API_TARGET`). All requests are asynchronous and the UI polls task state/events. The Linux service template binds loopback; the web proxy retains its same-origin write checks. ## Acceptance protocol diff --git a/PCB-SERVICE.md b/PCB-SERVICE.md index 0a179c6..da52fb3 100644 --- a/PCB-SERVICE.md +++ b/PCB-SERVICE.md @@ -8,17 +8,17 @@ ```bash cp .env.pcb.example .env.local -# 按实际部署修改 PCB_API_TARGET,默认 http://127.0.0.1:8003 +# 按实际部署修改 PCB_API_TARGET,默认 http://39.105.93.138:8003 ./start.sh ``` 普通 `./start.sh` 保留跨平台前端构建和静态服务器启动方式,默认访问 `http://localhost:5180/pcb/`。它不启动 AI 后台;后台缺失时仍可使用项目列表和原编辑器。开发时可运行 `pnpm -C designer dev`,默认端口 5173;代理配置通过启动进程的环境变量传入。`REBUILD=1 ./start.sh` 强制构建。 -AI 请求使用同源 `/pcb/pcb-api/sessions` 等路径,代理转发为后台 `/api/sessions`,默认目标为 `http://127.0.0.1:8003`。旧后台 `/api/v1/tasks` 与新协议不同,不应把新入口指向旧 8000/8002 服务。修改目标时同时核对 Vite、静态服务器和反向代理配置。 +AI 请求使用同源 `/pcb/pcb-api/sessions` 等路径,代理转发为后台 `/api/sessions`,默认目标为 `http://39.105.93.138:8003`。旧后台 `/api/v1/tasks` 与新协议不同,不应把新入口指向旧 8000/8002 服务。修改目标时同时核对 Vite、静态服务器和反向代理配置。 账号与平台工程接口 `/api/` 独立转发至 `API_TARGET`,默认开发平台 API;保留 Authorization,移除 Origin/Referer。统一登录、项目封面、工程保存和重新打开继续使用平台流程,不与 AI 会话记录混为同一数据集。 -AI 入口默认收起,点击“Codex AI 自动绘板”打开;显式带 `?ai=1` 可直接打开。保留 `designer/.env.local` 中的 `VITE_ENABLE_PCB_AI=false` 开关,关闭时不挂载 AI 组件、不轮询会话;修改此构建配置需重启开发服务器或重新构建。关闭工作台不取消服务端已提交的任务。 +AI 入口仅在打开项目且项目工作台加载完成后显示,返回项目列表时隐藏。默认收起,点击“Codex AI 自动绘板”打开;项目 URL 显式带 `?ai=1` 可直接打开。当前本地构建使用 `VITE_ENABLE_PCB_AI=true`;仍可在 `designer/.env.local` 中设置 `VITE_ENABLE_PCB_AI=false` 关闭 AI,关闭时不挂载 AI 组件、不轮询会话。修改此构建配置需重启开发服务器或重新构建。关闭工作台不取消服务端已提交的任务。 ## 新会话后台与现有 Linux 部署 diff --git a/designer/src/platform/PlatformApp.tsx b/designer/src/platform/PlatformApp.tsx index cba0b86..34ab832 100644 --- a/designer/src/platform/PlatformApp.tsx +++ b/designer/src/platform/PlatformApp.tsx @@ -727,7 +727,7 @@ function Workspace({ importProject={create} /> )} - {allowed && api && auth.status === 'authenticated' && ( + {activeWorkbench && allowed && api && auth.status === 'authenticated' && ( diff --git a/designer/vite.config.ts b/designer/vite.config.ts index 3ba4ffb..35cf15e 100644 --- a/designer/vite.config.ts +++ b/designer/vite.config.ts @@ -68,7 +68,7 @@ const uploadMaps = telemetryEnabled && !!(SENTRY_ORG && SENTRY_PROJECT && SENTRY const APP_BASE = process.env.VITE_BASE ?? '/pcb/'; function pcbProxy(): import('vite').ProxyOptions { return { - target: process.env.PCB_API_TARGET || 'http://127.0.0.1:8003', + target: process.env.PCB_API_TARGET || 'http://39.105.93.138:8003', changeOrigin: true, rewrite: (path: string) => '/api' + path.slice(`${APP_BASE}pcb-api`.length), configure: (proxy) => { diff --git a/scripts/package-pcb.mjs b/scripts/package-pcb.mjs index 6615c65..6f35381 100644 --- a/scripts/package-pcb.mjs +++ b/scripts/package-pcb.mjs @@ -37,6 +37,20 @@ The result must be /pcb/index.html, never pcb/pcb/index.html. Do n This package updates only pcb/. Preserve the main site, cad/, js/cad/, existing server configuration and backend services. Never clear the website or PCB directory before extraction. Check /pcb/build-info.json after deployment: scope=pcb, buildId=${buildId}. Configure frontend routes to fall back to /pcb/index.html. Keep /pcb/pcb-api/ routed to the separately running AI PCB service before applying the frontend fallback; static hosting does not start that backend. Keep existing account /api/ proxy and CORS settings. + +The configured AI backend for this release is http://39.105.93.138:8003. The browser uses same-origin /pcb/pcb-api/ requests. In the existing website server block, add or update the following location before the PCB frontend fallback: + + location ^~ /pcb/pcb-api/ { + proxy_pass http://39.105.93.138:8003/api/; + proxy_http_version 1.1; + proxy_set_header Host $proxy_host; + proxy_set_header Origin http://127.0.0.1:5173; + proxy_buffering off; + proxy_read_timeout 3600s; + add_header Cache-Control "no-store" always; + } + +Verify /pcb/pcb-api/health returns JSON with ok=true after deployment. The AI entry is enabled in this build and appears only after opening a project and loading its workbench. Serve index.html, sw.js, registerSW.js, build-info.json and the web manifest with Cache-Control: no-cache. Hashed assets can use immutable caching. Keep old hashed assets for already open editors. `); execFileSync('zip', ['-qr', join(stage, 'vibemake-pcb.zip'), '.'], { cwd: pcb }); diff --git a/scripts/serve.mjs b/scripts/serve.mjs index d4b71a5..d47c0b3 100644 --- a/scripts/serve.mjs +++ b/scripts/serve.mjs @@ -12,7 +12,7 @@ const siteBase = deployment.base; if (typeof siteBase !== 'string' || !siteBase.startsWith('/') || !siteBase.endsWith('/')) throw Error('Build base must be an absolute URL path ending in /'); const apiPrefix = `${siteBase}pcb-api/`; -const target = new URL(process.env.PCB_API_TARGET || 'http://127.0.0.1:8003'); +const target = new URL(process.env.PCB_API_TARGET || 'http://39.105.93.138:8003'); if (!['http:', 'https:'].includes(target.protocol) || target.username || target.password) throw Error('PCB_API_TARGET must be an HTTP(S) address without embedded credentials'); const platformTarget = new URL(process.env.API_TARGET || 'https://dev-vibemake-api.robotquan.com');