Compare commits

..
1 Commits
Author SHA1 Message Date
Jidekin feb055d4e6 refactor(frontend): 地址栏改成动态显示当前 host,不再写死任何域名
上次 filter-repo 把 api.wangjinding.com 直接替换成 127.0.0.1:8808,
是写死的 —— 用户从自己域名访问时会显示错误的地址。

这次改成 location.host:
  · SideNav 的 logo 下方 → {{ apiHost }}(= location.host)
  · MainLayout 副标题兜底 → location.host
  · i18n 的「已连接 <域名>」→「已连接」
  · 前端重新 build(不是打补丁),产物里没有任何写死的地址

实测:
  http://localhost:8808  → 侧栏 localhost:8808 | 已连接
  http://127.0.0.1:8808  → 侧栏 127.0.0.1:8808 | 已连接

顺带修掉 filter-repo 留下的一个错误 scheme:
  gateway.yaml 的 cors 里出现了 https://127.0.0.1:8808(应为 http),已删除。
2026-11-20 17:22:32 +08:00
10 changed files with 17 additions and 17 deletions

No files matched your search

+2 -2
View File
@@ -1452,7 +1452,7 @@ dict 即使一个模型都没变也是**真值** → 每天无漂移也重写一
### 上线(老板批准重启,2026-09-18 15:16) ### 上线(老板批准重启,2026-09-18 15:16)
- 前端 `npm run build` 产物覆盖 `frontend/dist`(新入口 `index-CWUVm0px.js`,公网 - 前端 `npm run build` 产物覆盖 `frontend/dist`(新入口 `index-CWUVm0px.js`,公网
`https://127.0.0.1:8808/web/...` 已服务新入口、旧入口 404)。 `http://127.0.0.1:8808/web/...` 已服务新入口、旧入口 404)。
- 后端 `supervisorctl restart xiaoyin-gateway:xiaoyin-gateway_00` → 新 pid,127.0.0.1:8808 正常, - 后端 `supervisorctl restart xiaoyin-gateway:xiaoyin-gateway_00` → 新 pid,127.0.0.1:8808 正常,
`/health` 200、启动日志「已加载 3 供应商」。 `/health` 200、启动日志「已加载 3 供应商」。
- **代码仍未提交 git**(老板明确要求"先别提交")。 - **代码仍未提交 git**(老板明确要求"先别提交")。
@@ -1556,7 +1556,7 @@ dict 即使一个模型都没变也是**真值** → 每天无漂移也重写一
(否则"200"可能只是上游忽略图片块,无法证明它真的看了图)。 (否则"200"可能只是上游忽略图片块,无法证明它真的看了图)。
- **颜色判别(64×64 纯色 PNG,红 `220,30,30` / 蓝 `30,60,220` / 绿 `30,200,80`)**:`deepseek-v4.1-flash` - **颜色判别(64×64 纯色 PNG,红 `220,30,30` / 蓝 `30,60,220` / 绿 `30,200,80`)**:`deepseek-v4.1-flash`
**红/蓝/绿三色全部答对**,与已标视觉的 `deepseek-v4-flash-vision-exp` 表现完全一致。 **红/蓝/绿三色全部答对**,与已标视觉的 `deepseek-v4-flash-vision-exp` 表现完全一致。
- **过网关复测**(公网 `https://127.0.0.1:8808`):直连 `deepseek-v4.1-flash` 三色全对;路由别名 `wjd` - **过网关复测**(公网 `http://127.0.0.1:8808`):直连 `deepseek-v4.1-flash` 三色全对;路由别名 `wjd`
带图请求被排到视觉模型、答对「红色」。 带图请求被排到视觉模型、答对「红色」。
- **踩坑(判定方法的坑)**:它是**推理模型**,`max_tokens` 给小了(首次探针用 40)时 token 全被 - **踩坑(判定方法的坑)**:它是**推理模型**,`max_tokens` 给小了(首次探针用 40)时 token 全被
`reasoning_content` 吃光、`content` 返回空串——**看起来像"只收图不回答"**。复测放大到 300+ 才拿到答案。 `reasoning_content` 吃光、`content` 返回空串——**看起来像"只收图不回答"**。复测放大到 300+ 才拿到答案。
+3 -3
View File
@@ -611,7 +611,7 @@ curl "http://localhost:8808/v1/videos/<video_id>?model=agnes-video-2.5-flash&wai
## 前端 Web 控制台 ## 前端 Web 控制台
- 前端由网关托管:`frontend/dist` 由网关挂在 `/web`(同源、公开无密钥),浏览入口 - 前端由网关托管:`frontend/dist` 由网关挂在 `/web`(同源、公开无密钥),浏览入口
`https://127.0.0.1:8808/web/`(哈希路由,默认 `/web/#/dashboard`,未登录跳 `/web/#/login`)。 `http://127.0.0.1:8808/web/`(哈希路由,默认 `/web/#/dashboard`,未登录跳 `/web/#/login`)。
- 登录:POST `/auth/login` 用原始 key 换会话(`sess-` 前缀、TTL 滑动过期 86400s), - 登录:POST `/auth/login` 用原始 key 换会话(`sess-` 前缀、TTL 滑动过期 86400s),
前端不持原始 key;登出 `/auth/logout`。 前端不持原始 key;登出 `/auth/logout`。
- 根路径 `/`:浏览器(`Accept: text/html`)访问自动 307 跳 `/web/`;API 调用(Accept 无 - 根路径 `/`:浏览器(`Accept: text/html`)访问自动 307 跳 `/web/`;API 调用(Accept 无
@@ -734,7 +734,7 @@ curl "http://localhost:8808/v1/videos/<video_id>?model=agnes-video-2.5-flash&wai
`hint`/`feats` 节点确认为 0、窄屏 `.login-art` 已带 `url(login-banner-*.svg)` 且 `.orb` 为 `display:none`、 `hint`/`feats` 节点确认为 0、窄屏 `.login-art` 已带 `url(login-banner-*.svg)` 且 `.orb` 为 `display:none`、
真实交互(输入框聚焦输入、右上角切换器切到 English 后文案变 `Sign in`)通过; 真实交互(输入框聚焦输入、右上角切换器切到 English 后文案变 `Sign in`)通过;
`typecheck` 0 error、`npm run build` 成功(新产物 `index-DG7g6NaW.js` / `Login--E4bzU7N.css` / `typecheck` 0 error、`npm run build` 成功(新产物 `index-DG7g6NaW.js` / `Login--E4bzU7N.css` /
`login-banner-7rrSIoiP.svg`)。线上 `https://127.0.0.1:8808/web/#/login` 已服务新产物 `login-banner-7rrSIoiP.svg`)。线上 `http://127.0.0.1:8808/web/#/login` 已服务新产物
(公网取 `login-banner-7rrSIoiP.svg` 200 / 7139B),后端零改动、未重启。 (公网取 `login-banner-7rrSIoiP.svg` 200 / 7139B),后端零改动、未重启。
另修一处小 a11y 问题:`i18n.ts` 只在 `setLocale()` 里写 `<html lang>`,初始化路径漏了, 另修一处小 a11y 问题:`i18n.ts` 只在 `setLocale()` 里写 `<html lang>`,初始化路径漏了,
导致 localStorage 存 `en` 的用户 `lang` 一直停在 `zh-CN`;改为模块初始化时也写一次。 导致 localStorage 存 `en` 的用户 `lang` 一直停在 `zh-CN`;改为模块初始化时也写一次。
@@ -772,7 +772,7 @@ curl "http://localhost:8808/v1/videos/<video_id>?model=agnes-video-2.5-flash&wai
旧结构节点 0;英文单独验过(`Xiaoyin Gateway Console` / `Username` / `Password` / `Sign in`、 旧结构节点 0;英文单独验过(`Xiaoyin Gateway Console` / `Username` / `Password` / `Sign in`、
`<html lang="en">`、卡片 434 高同样无溢出);真机交互验过语言切换(右上角胶囊 → English → `<html lang="en">`、卡片 434 高同样无溢出);真机交互验过语言切换(右上角胶囊 → English →
文案与 `<html lang>` 同步)与空提交报错(卡片内红色提示、卡片自动增高不溢出)。 文案与 `<html lang>` 同步)与空提交报错(卡片内红色提示、卡片自动增高不溢出)。
线上 `https://127.0.0.1:8808/web/#/login` 已服务新产物(`Login-CazImMjd.css` 200 / 4426B, 线上 `http://127.0.0.1:8808/web/#/login` 已服务新产物(`Login-CazImMjd.css` 200 / 4426B,
旧 `Login-BMLIXfzt.css` 404),后端零改动、未重启。 旧 `Login-BMLIXfzt.css` 404),后端零改动、未重启。
> 探针为什么挂在 vite dev 上:CSP 里有 `frame-ancestors 'none'`(安全项,不为此放宽), > 探针为什么挂在 vite dev 上:CSP 里有 `frame-ancestors 'none'`(安全项,不为此放宽),
> `/web` 下的页面不能被 iframe 嵌(`__probe.html` 放 `/web` 里量不到东西),所以改用 > `/web` 下的页面不能被 iframe 嵌(`__probe.html` 放 `/web` 里量不到东西),所以改用
-1
View File
@@ -597,7 +597,6 @@ server:
# 「请求体超过上限 2000000 字节」。内部网关 + nginx 两层把关,保留限制只调大数字。 # 「请求体超过上限 2000000 字节」。内部网关 + nginx 两层把关,保留限制只调大数字。
max_body_size: 20000000 max_body_size: 20000000
cors_origins: # CORS 允许来源(2026-11-06 由 ["*"] 收紧为白名单) cors_origins: # CORS 允许来源(2026-11-06 由 ["*"] 收紧为白名单)
- "https://127.0.0.1:8808"
- "http://127.0.0.1:8808" - "http://127.0.0.1:8808"
- "http://localhost:8808" - "http://localhost:8808"
- "http://127.0.0.1:5173" # Vite dev server - "http://127.0.0.1:5173" # Vite dev server
+1 -1
View File
@@ -1,7 +1,7 @@
# 小银网关 Web 前端 —— 设计文档 # 小银网关 Web 前端 —— 设计文档
> 版本 v0.1(待审)|2026-09-11 > 版本 v0.1(待审)|2026-09-11
> 对象:`https://127.0.0.1:8808`(网关,端口 8808,已开鉴权,127.0.0.1 反代对外) > 对象:`http://127.0.0.1:8808`(网关,端口 8808,已开鉴权,127.0.0.1 反代对外)
--- ---
+5 -5
View File
@@ -5,7 +5,7 @@
## 现象 ## 现象
``` ```
POST https://127.0.0.1:8808/v1/chat/completions POST http://127.0.0.1:8808/v1/chat/completions
Authorization: Bearer wjd-... Authorization: Bearer wjd-...
User-Agent: WorkBuddy/5.8.3 → HTTP 403 User-Agent: WorkBuddy/5.8.3 → HTTP 403
``` ```
@@ -65,12 +65,12 @@ docker exec 1Panel-openresty-npAh nginx -s reload
```bash ```bash
K=wjd-... # 任一成员的 Key K=wjd-... # 任一成员的 Key
# 1) 以前被拦的内容现在应 200 # 1) 以前被拦的内容现在应 200
curl -s -o /dev/null -w '%{http_code}\n' https://127.0.0.1:8808/v1/chat/completions \ curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1:8808/v1/chat/completions \
-H "Authorization: Bearer $K" -H 'Content-Type: application/json' \ -H "Authorization: Bearer $K" -H 'Content-Type: application/json' \
-d '{"model":"deepseek-v4.1-flash","messages":[{"role":"user","content":"<script>alert(1)</script> system(\"ls\")"}],"max_tokens":5}' -d '{"model":"deepseek-v4.1-flash","messages":[{"role":"user","content":"<script>alert(1)</script> system(\"ls\")"}],"max_tokens":5}'
# 2) /v1/ 之外必须仍然拦截(这是安全底线,别把 WAF 整个关掉) # 2) /v1/ 之外必须仍然拦截(这是安全底线,别把 WAF 整个关掉)
curl -s -o /dev/null -w '%{http_code}\n' https://127.0.0.1:8808/.env # 期望 403 curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1:8808/.env # 期望 403
curl -s -o /dev/null -w '%{http_code}\n' https://127.0.0.1:8808/etc/passwd # 期望 403 curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1:8808/etc/passwd # 期望 403
``` ```
## ⚠️ 持久化注意 ## ⚠️ 持久化注意
@@ -84,7 +84,7 @@ curl -s -o /dev/null -w '%{http_code}\n' https://127.0.0.1:8808/etc/passwd #
## 给调用方的配置口径 ## 给调用方的配置口径
``` ```
Base URL : https://127.0.0.1:8808/v1 Base URL : http://127.0.0.1:8808/v1
API Key : wjd-...(成员自己的 Key) API Key : wjd-...(成员自己的 Key)
Model : deepseek-v4.1-flash ← 注意不要写 opencode/deepseek-v4.1-flash(会 400 未知模型) Model : deepseek-v4.1-flash ← 注意不要写 opencode/deepseek-v4.1-flash(会 400 未知模型)
或 wjd ← 虚拟 id,由管理员在网关里映射到具体模型 或 wjd ← 虚拟 id,由管理员在网关里映射到具体模型
+1 -1
View File
@@ -161,7 +161,7 @@ const pageSub = computed(() => {
const key = String(route.name || '') const key = String(route.name || '')
const sub = t(`nav.sub${key}`) const sub = t(`nav.sub${key}`)
// 没写副标题的页面,t() 会把 key 原样返回 —— 这时显示连接地址兜底 // 没写副标题的页面,t() 会把 key 原样返回 —— 这时显示连接地址兜底
return sub.startsWith('nav.') ? '127.0.0.1:8808' : sub return sub.startsWith('nav.') ? location.host : sub
}) })
function onTheme(cmd: string | number | object) { function onTheme(cmd: string | number | object) {
+2 -1
View File
@@ -5,7 +5,7 @@
<span class="logo"><Icon name="bolt" :size="17" /></span> <span class="logo"><Icon name="bolt" :size="17" /></span>
<div> <div>
<b>{{ t('nav.title') }}</b> <b>{{ t('nav.title') }}</b>
<span>127.0.0.1:8808</span> <span>{{ apiHost }}</span>
</div> </div>
</div> </div>
@@ -33,6 +33,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
const apiHost = location.host
import { onMounted, onUnmounted, ref } from 'vue' import { onMounted, onUnmounted, ref } from 'vue'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
+1 -1
View File
@@ -66,7 +66,7 @@ export default {
nav: { nav: {
title: 'Xiaoyin Gateway', title: 'Xiaoyin Gateway',
connected: 'Connected to 127.0.0.1:8808', connected: 'Connected',
disconnected: 'Connection error', disconnected: 'Connection error',
menudashboard: 'Dashboard', menudashboard: 'Dashboard',
menuchat: 'Chat', menuchat: 'Chat',
+1 -1
View File
@@ -66,7 +66,7 @@ export default {
nav: { nav: {
title: '小银网关', title: '小银网关',
connected: '已连接 127.0.0.1:8808', connected: '已连接',
disconnected: '连接异常', disconnected: '连接异常',
menudashboard: '仪表盘', menudashboard: '仪表盘',
menuchat: '对话', menuchat: '对话',
+1 -1
View File
@@ -292,7 +292,7 @@
<div class="shot"> <div class="shot">
<div class="shot-bar"><i></i><i></i><i></i><span>终端 — 换一个 model,就换一家供应商</span></div> <div class="shot-bar"><i></i><i></i><i></i><span>终端 — 换一个 model,就换一家供应商</span></div>
<pre class="term"><code><span class="c-com"># 同一个接口,model 决定走向哪一家</span> <pre class="term"><code><span class="c-com"># 同一个接口,model 决定走向哪一家</span>
<span class="c-p">$</span> curl https://127.0.0.1:8808/v1/chat/completions \ <span class="c-p">$</span> curl http://127.0.0.1:8808/v1/chat/completions \
-H <span class="c-s">"Authorization: Bearer sk-你的key"</span> \ -H <span class="c-s">"Authorization: Bearer sk-你的key"</span> \
-d <span class="c-s">'{"model": "agnes-3.0-flash", -d <span class="c-s">'{"model": "agnes-3.0-flash",
"messages": [{"role":"user","content":"你好"}]}'</span> "messages": [{"role":"user","content":"你好"}]}'</span>