diff --git a/deploy/fba/fba-ui-src/apps/web-antdv-next/src/api/iaop/infer.ts b/deploy/fba/fba-ui-src/apps/web-antdv-next/src/api/iaop/infer.ts index a5e88f5..4ca6b3f 100644 --- a/deploy/fba/fba-ui-src/apps/web-antdv-next/src/api/iaop/infer.ts +++ b/deploy/fba/fba-ui-src/apps/web-antdv-next/src/api/iaop/infer.ts @@ -1,16 +1,17 @@ /** * iAOP LLM 网关客户端(Epic #163 / issue #166 [A3]) * - * 对齐旧 `web/` 各模块的 INFER_BASE(nginx 反代 /v1/ → 推理服务 :30800): - * GET /v1/health —— 健康巡检 + * 对齐旧 `web/` 各模块的 INFER_BASE(nginx 反代 → 推理服务 :30800): + * GET /health —— 健康巡检(serve.py 探针路由无前缀) * GET /v1/models —— 模型列表 * POST /v1/chat/completions —— OpenAI 兼容对话(dry-run 占位 / 真实推理) * * 推理服务为 iAOP 独立通道(不要求 FBA JWT),故用原生 fetch 封装, * 统一超时 / 错误信息 / 结果结构;FBA requestClient 仅用于 /fba/* 接口。 * - * issue #188:推理服务真实路径即 :30800/v1/*,nginx 反代 /v1/ 不去前缀直接透传, - * 故 BASE_URL 为空串,调用方统一写 /v1/models、/v1/chat/completions, + * issue #188(bot_qa 审核修正):nginx 反代使用不带 URI 的 proxy_pass + * 原样透传,故 BASE_URL 为空串,调用方按后端真实路由写 + * /v1/models、/v1/chat/completions、/health(健康探针无 /v1 前缀), * 避免出现 /v1/v1 双前缀对 nginx rewrite 的隐式耦合。 */ const BASE_URL = ''; @@ -65,7 +66,7 @@ async function fetchJson(path: string, init?: RequestInit): Promise { /** 健康巡检(前端徽标展示;失败不抛出,由调用方降级) */ export async function fetchHealth(): Promise | null> { try { - return await fetchJson>('/v1/health'); + return await fetchJson>('/health'); } catch { return null; } diff --git a/deploy/fba/fba-ui-src/apps/web-antdv-next/src/views/iaop/chat/index.vue b/deploy/fba/fba-ui-src/apps/web-antdv-next/src/views/iaop/chat/index.vue index a4009de..46cf9f7 100644 --- a/deploy/fba/fba-ui-src/apps/web-antdv-next/src/views/iaop/chat/index.vue +++ b/deploy/fba/fba-ui-src/apps/web-antdv-next/src/views/iaop/chat/index.vue @@ -68,7 +68,7 @@ async function send() { messages.value.push({ role: 'assistant', content: r.text, meta, citations: hits }); } catch { offline.value = true; - messages.value.push({ role: 'assistant', content: '推理服务请求失败,请检查网关(/v1/health)。' }); + messages.value.push({ role: 'assistant', content: '推理服务请求失败,请检查网关(/health)。' }); } finally { loading.value = false; scrollBottom(); diff --git a/deploy/fba/fba-ui-src/apps/web-antdv-next/src/views/iaop/cockpit/components/NlQuery.vue b/deploy/fba/fba-ui-src/apps/web-antdv-next/src/views/iaop/cockpit/components/NlQuery.vue index c8133c2..96ef7cf 100644 --- a/deploy/fba/fba-ui-src/apps/web-antdv-next/src/views/iaop/cockpit/components/NlQuery.vue +++ b/deploy/fba/fba-ui-src/apps/web-antdv-next/src/views/iaop/cockpit/components/NlQuery.vue @@ -45,7 +45,7 @@ async function submit() { 查询 - +
{{ answer }}
diff --git a/deploy/fba/fba-ui-src/apps/web-antdv-next/src/views/iaop/cockpit/index.vue b/deploy/fba/fba-ui-src/apps/web-antdv-next/src/views/iaop/cockpit/index.vue index 5b90569..d2a8ad1 100644 --- a/deploy/fba/fba-ui-src/apps/web-antdv-next/src/views/iaop/cockpit/index.vue +++ b/deploy/fba/fba-ui-src/apps/web-antdv-next/src/views/iaop/cockpit/index.vue @@ -54,7 +54,7 @@ onUnmounted(() => window.clearInterval(timer)); const inferOnline = ref(false); async function refreshHealth() { - // issue #188:健康检查改走 infer.ts 的 fetchHealth 封装,路径口径统一(/v1/health) + // issue #188:健康检查改走 infer.ts 的 fetchHealth 封装,路径口径统一(/health,无前缀) const d = await fetchHealth(); const status = d?.status; inferOnline.value = status === 'ok' || status === 'dry-run'; diff --git a/deploy/fba/nginx-fba.conf b/deploy/fba/nginx-fba.conf index e61655b..4f88d08 100644 --- a/deploy/fba/nginx-fba.conf +++ b/deploy/fba/nginx-fba.conf @@ -68,13 +68,18 @@ location /fba-admin/ { # ============================================================================= # 推理通道(iAOP LLM 网关) # -# issue #188:推理服务真实路径即 :30800/v1/*(/v1/models、/v1/chat/completions、 -# /v1/health),故 nginx 反代 /v1/ 时 proxy_pass 带 / —— 不去前缀,直接透传, -# 消除前端「拼出 /v1/v1 靠 rewrite 巧合耦合」的隐式依赖。 -# 前端 infer.ts BASE_URL 为空串,统一写 /v1/models、/v1/chat/completions、/v1/health。 +# issue #188(bot_qa 审核修正):推理服务真实路径为 +# POST /v1/chat/completions、GET /v1/models(带 /v1 前缀) +# GET /health(健康探针,**无 /v1 前缀**,见 deploy/k8s/docker/serve.py) +# +# 注意 nginx 语义:proxy_pass 带 URI 部分(含末尾 /)时会把 location 匹配 +# 前缀**替换**掉(即"去前缀",同上方 /fba/ 块用法);要"原样透传"必须 +# 使用不带 URI 的 proxy_pass(无末尾 /),请求 URI 完整转发给后端。 +# 前端 infer.ts BASE_URL 为空串,统一写 /v1/models、/v1/chat/completions、/health。 # ============================================================================= location /v1/ { - proxy_pass http://127.0.0.1:30800/; + # 不带 URI(无末尾 /):/v1/models → :30800/v1/models 原样透传 + proxy_pass http://127.0.0.1:30800; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; @@ -84,3 +89,13 @@ location /v1/ { client_max_body_size 20m; proxy_read_timeout 120s; } + +# 健康探针无前缀,单独精确透传:/health → :30800/health +location = /health { + proxy_pass http://127.0.0.1:30800; + + 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; +}