feature/issue-188
main
修复 issue #188 [P1] 推理 API 路径规范化,消除双 /v1 前缀对 nginx rewrite 的隐式依赖(生产交付审计发现)。
/v1
api/iaop/infer.ts 里 BASE_URL=/v1,但 fetchModels 拼 /v1/models、chatCompletion 拼 /v1/chat/completions,实际请求 /v1/v1/models。目前能通仅因 nginx 对 /v1/ 做了 rewrite 去前缀(巧合耦合);nginx 配置一旦调整,推理全链路静默失效。另 cockpit/index.vue 裸 fetch('/v1/health') 未走 infer.ts 封装,路径口径不一致。
api/iaop/infer.ts
BASE_URL=/v1
fetchModels
/v1/models
chatCompletion
/v1/chat/completions
/v1/v1/models
/v1/
cockpit/index.vue
fetch('/v1/health')
deploy/fba/nginx-fba.conf
location /v1/
proxy_pass http://127.0.0.1:30800/
/
BASE_URL
/v1/health
fetchHealth
/health
fetchHealth()
latencyMs
0
performance.now()
/v1/v1
fixes #188
问题:infer.ts BASE_URL=/v1,fetchModels/chatCompletion 再拼 /v1/* 导致 /v1/v1 双前缀,当前仅靠 nginx 对 /v1/ rewrite 去前缀巧合耦合才通。 修复(前后端+部署一起改): 1. nginx-fba.conf:新增 location /v1/,proxy_pass http://127.0.0.1:30800/ (带末尾 /,不去前缀直接透传),消除对 rewrite 的隐式依赖。 2. infer.ts:BASE_URL 改为空串,调用方统一写 /v1/models、 /v1/chat/completions、/v1/health(fetchHealth 原误用 /health 已修正)。 3. cockpit/index.vue:健康检查改走 infer.ts 的 fetchHealth 封装, 不再裸 fetch('/v1/health'),路径口径统一。 4. ask() latencyMs 由硬编码 0 改为 performance.now() 实测耗时。 5. README 补充推理通道路径约定说明。 验收:浏览器 Network 确认 /v1/models、/v1/chat/completions、 /v1/health 均 200 且无 /v1/v1 请求。(本环境无 pnpm,构建验证转 bot_qa)
PR 引用未同步(head 滞留 5667fad)。内容已按 feature/issue-188 最新 9994fb7 手工合并进 main(merge commit b80fe6a),关闭本 PR。
9994fb7
No dependencies set.
The note is not visible to the blocked user.
概述
修复 issue #188 [P1] 推理 API 路径规范化,消除双
/v1前缀对 nginx rewrite 的隐式依赖(生产交付审计发现)。问题
api/iaop/infer.ts里BASE_URL=/v1,但fetchModels拼/v1/models、chatCompletion拼/v1/chat/completions,实际请求/v1/v1/models。目前能通仅因 nginx 对/v1/做了 rewrite 去前缀(巧合耦合);nginx 配置一旦调整,推理全链路静默失效。另cockpit/index.vue裸fetch('/v1/health')未走 infer.ts 封装,路径口径不一致。修复(前后端+部署一起改)
deploy/fba/nginx-fba.conf):新增location /v1/,proxy_pass http://127.0.0.1:30800/(带末尾/,不去前缀直接透传),推理服务真实路径即 :30800/v1/*。BASE_URL改为空串,调用方统一写/v1/models、/v1/chat/completions、/v1/health(fetchHealth原误用/health已修正为/v1/health)。fetchHealth()封装,不再裸fetch('/v1/health')。latencyMs由硬编码0改为performance.now()实测耗时。验收
/v1/v1双前缀(BASE_URL='' + 显式 /v1/*)/v1/models、/v1/chat/completions、/v1/health均 200:本环境无 pnpm/node_modules,转 bot_qa 构建环境验证fixes #188
PR 引用未同步(head 滞留 5667fad)。内容已按 feature/issue-188 最新
9994fb7手工合并进 main(merge commit b80fe6a),关闭本 PR。Pull request closed