diff --git a/app/routers/chatbot.py b/app/routers/chatbot.py index 4bb2e88..693d7dc 100644 --- a/app/routers/chatbot.py +++ b/app/routers/chatbot.py @@ -355,7 +355,8 @@ async def _handle_wechat_request(request: Request, app_id: Optional[str], backgr response_app_id = str(data.get("ChannelId", "") or data.get("appid", "")).strip() or APP_ID else: resp_plain = json.dumps({"answer_type": "text", "text_info": {"short_answer": answer_text}}, ensure_ascii=False) - response_app_id = None if app_id else APP_ID + # thirdapi 场景也要携带 app_id 参与加密,否则平台可能判定回包无效 + response_app_id = (app_id or APP_ID).strip() if isinstance(app_id, str) else APP_ID return aes_encrypt_base64(resp_plain, ENCODING_AES_KEY, response_app_id)