From 38cea985f19ffab16d418ef8b3ecd420971772d4 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Sat, 30 May 2026 00:28:47 +0800 Subject: [PATCH] =?UTF-8?q?debug:=20rl=5Fcallback=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E8=AF=A6=E7=BB=86=E6=97=A5=E5=BF=97=E5=92=8C=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E6=8D=95=E8=8E=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wwwroot/api/rl_callback.dspy | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/wwwroot/api/rl_callback.dspy b/wwwroot/api/rl_callback.dspy index c48bfc1..0e43ebf 100644 --- a/wwwroot/api/rl_callback.dspy +++ b/wwwroot/api/rl_callback.dspy @@ -1,5 +1,6 @@ import json -from appPublic.log import debug +import traceback +from appPublic.log import debug, error # Vendor callback: GET or POST # Volcengine example (GET): @@ -7,8 +8,10 @@ from appPublic.log import debug # &reqMeasureInfoValue=1&verify_type=real_time # Return format depends on vendor requirements. +debug("[rl_callback] ===== START =====") debug(f"[rl_callback] params_kw keys: {list(params_kw.keys())}") debug(f"[rl_callback] params_kw: {params_kw}") +print(f"[rl_callback] params_kw: {params_kw}") body_str = http_request.get("body", "") or "" byted_token = "" @@ -20,32 +23,45 @@ try: byted_token = (body.get("BytedToken") or body.get("bytedToken") or body.get("byted_token") or body.get("Token") or "") result_code = body.get("resultCode") or body.get("ResultCode") or "" -except: - pass + debug(f"[rl_callback] from body: byted_token={byted_token}, result_code={result_code}") +except Exception as e: + error(f"[rl_callback] body parse error: {e}") + debug(f"[rl_callback] body parse error: {e}") # 2. Fallback: query string params (GET callback) if not byted_token: byted_token = (params_kw.get("bytedToken") or params_kw.get("BytedToken") or params_kw.get("byted_token") - or params_kw.get("BytedToken") or "") if not result_code: result_code = params_kw.get("resultCode", "") -debug(f"[rl_callback] byted_token={byted_token}, resultCode={result_code}") +debug(f"[rl_callback] final: byted_token={byted_token}, resultCode={result_code}") +print(f"[rl_callback] final: byted_token={byted_token}, resultCode={result_code}") if not byted_token: + debug("[rl_callback] ERROR: missing bytedToken") return json.dumps({"code": "400", "message": "Missing bytedToken"}) # Process callback -result = await rl_handle_callback(byted_token, project_name="default") - -debug(f"[rl_callback] handle_callback result: {result}") +try: + debug(f"[rl_callback] calling rl_handle_callback with byted_token={byted_token}") + result = await rl_handle_callback(byted_token, project_name="default") + debug(f"[rl_callback] handle_callback result: {result}") + print(f"[rl_callback] handle_callback result: {result}") +except Exception as e: + error(f"[rl_callback] rl_handle_callback exception: {e}\n{traceback.format_exc()}") + debug(f"[rl_callback] rl_handle_callback exception: {e}") + print(f"[rl_callback] rl_handle_callback exception: {e}") + print(traceback.format_exc()) + return json.dumps({"code": "500", "message": f"Internal error: {str(e)}"}) # Volcengine expects HTTP 200 with any body for success. # Return a simple success/failure response. if result.get("success"): + debug("[rl_callback] SUCCESS") return json.dumps({"code": "200", "message": "ok"}) else: + debug(f"[rl_callback] FAILED: {result.get('message', 'unknown')}") return json.dumps({"code": "500", "message": result.get("message", "callback error")})