fix: 还原rl_callback.dspy, 供应商回调返回格式由供应商决定
This commit is contained in:
parent
211b628c78
commit
ccb9430a25
@ -1,8 +1,7 @@
|
|||||||
import json
|
|
||||||
|
|
||||||
# Vendor callback POSTs JSON body with BytedToken.
|
# Vendor callback POSTs JSON body with BytedToken.
|
||||||
# The callback URL is configured when calling CreateVisualValidateSession.
|
# The callback URL is configured when calling CreateVisualValidateSession.
|
||||||
# Typical payload: {"BytedToken": "...", "ReqUUID": "...", "Status": "..."}
|
# Typical payload: {"BytedToken": "...", "ReqUUID": "...", "Status": "..."}
|
||||||
|
# Return format depends on vendor requirements.
|
||||||
|
|
||||||
body_str = http_request.get("body", "") or ""
|
body_str = http_request.get("body", "") or ""
|
||||||
byted_token = ""
|
byted_token = ""
|
||||||
@ -21,12 +20,8 @@ if not byted_token:
|
|||||||
byted_token = params_kw.get("BytedToken", params_kw.get("byted_token", ""))
|
byted_token = params_kw.get("BytedToken", params_kw.get("byted_token", ""))
|
||||||
|
|
||||||
if not byted_token:
|
if not byted_token:
|
||||||
return json.dumps({"status": "error", "data": {"message": "缺少 BytedToken 参数"}}, ensure_ascii=False)
|
return {"success": False, "message": "缺少 BytedToken 参数"}
|
||||||
|
|
||||||
# vendor is determined by looking up the session record
|
# vendor is determined by looking up the session record
|
||||||
result = await rl_handle_callback(byted_token, project_name="default")
|
result = await rl_handle_callback(byted_token, project_name="default")
|
||||||
|
return result
|
||||||
if result.get('success'):
|
|
||||||
return json.dumps({"status": "ok", "data": {"vendor_group_id": result.get('vendor_group_id', '')}}, ensure_ascii=False)
|
|
||||||
else:
|
|
||||||
return json.dumps({"status": "error", "data": {"message": result.get('message', '回调处理失败')}}, ensure_ascii=False)
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user