From bf82c684083d86a5043b4941aa26494238e018d3 Mon Sep 17 00:00:00 2001 From: zhangxianze Date: Wed, 10 Jun 2026 19:35:58 +0800 Subject: [PATCH] =?UTF-8?q?feat(compare):=20=E7=BE=8E=E5=9B=A2=E6=AF=94?= =?UTF-8?q?=E4=BB=B7=E5=89=8D=E7=94=A8=E5=88=B8=E9=80=8F=E4=BC=A0=E7=AB=AF?= =?UTF-8?q?=E7=82=B9=20/intent/precoupon/step=20(#41)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 背景 客户端在美团源比价的**意图识别前**先循环调本端点用券。app-server 只做透传壳(决策在 pricebot-backend)。 ## 改动 - 新增 `POST /api/v1/intent/precoupon/step` → 透传到 pricebot-backend `/api/intent/precoupon/step` - 同 `/intent/step` 透传壳: 不鉴权、不做 schema 校验, device_id 透传区分设备 ## 测试 - 链路自测(:8770 → :8000) + 真机实测用券成功 ## 关联(跨三仓库, 同名分支 `feat/meituan-precoupon`) - WonderableAI/pricebot-backend - WonderableAI/shaguabijia-app-server - WonderableAI/shaguabijia-app-android **改协议字段需三仓库一起改。** 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: xianze Reviewed-on: https://gitea.shaguabijia.com/WonderableAI/shaguabijia-app-server/pulls/41 Co-authored-by: zhangxianze Co-committed-by: zhangxianze --- app/api/v1/compare.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/api/v1/compare.py b/app/api/v1/compare.py index 42bcddd..93279b3 100644 --- a/app/api/v1/compare.py +++ b/app/api/v1/compare.py @@ -102,6 +102,17 @@ async def intent_step(request: Request) -> dict[str, Any]: return await _passthrough(request, "/api/intent/step") +@router.post( + "/intent/precoupon/step", + summary="外卖比价 Phase 0 意图识别前先用券 (透传到 pricebot, 仅美团源)", +) +async def intent_precoupon_step(request: Request) -> dict[str, Any]: + # 美团源平台『意图识别前先用券』多帧循环: 客户端在调 /intent/recognize 之前先循环 + # 调本端点到 done(continue=false)。订单页底部有『点击使用X红包』就自动选最大免费券 + # 用上, 已用券/无券则首帧秒过。与 /intent/step 同属 intent 域, 复用同一透传壳。 + return await _passthrough(request, "/api/intent/precoupon/step") + + @router.post("/price/step", summary="外卖比价 Phase 2 步进 (透传到 pricebot)") async def price_step(request: Request) -> dict[str, Any]: return await _passthrough(request, "/api/price/step")