pipeline-bidding/wwwroot/api/bid_delivery_reject.dspy

41 lines
2.0 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# bid_delivery_reject.dspy - 交付确认待办的「退回交付」端点(2026-09-17)
#
# 背景:bid_delivery_confirm 待办原来只有确认通道(human_task_complete),用户复核
# 发现问题时无法退回。本端点补退回通道,对齐 tech_template_confirm 的 confirm/reject
# 双通道模式。退回是用户专属裁决(agent 无此工具,不能替用户退回)。
#
# 入参(form-encoded):
# human_task_id 交付确认待办 id(pipeline_human_tasks.id,task_type=bid_delivery_confirm)
# comment 退回意见(必填:说明标书哪里需要修改,评分员按意见打回章节)
#
# 机制(reject_delivery):待办置 rejected + 意见存 result_data → 最新 passed 标书置
# rejected → 派 scorer bid_delivery_reject 任务(在办期间对账器不重合成,防绕过)→
# scorer request_chapter_revise 打回问题章节 → 既有链路自动重写→重审→重合成→重评分
# → 重发新版交付确认待办。
import json as _json
user_id = await get_user()
if not user_id:
return _json.dumps({"success": False, "error": "未登录"}, ensure_ascii=False)
human_task_id = str((params_kw or {}).get('human_task_id') or '').strip()
comment = str((params_kw or {}).get('comment') or '').strip()
if not human_task_id:
return _json.dumps({"success": False, "error": "缺少 human_task_id"}, ensure_ascii=False)
if not comment:
return _json.dumps({"success": False, "error": "退回必须填写意见"}, ensure_ascii=False)
try:
from pipeline_bidding.bid_score_capability import reject_delivery
except Exception as e:
return _json.dumps({"success": False,
"error": "投标产线评分能力模块不可用:%s" % str(e)[:150]},
ensure_ascii=False)
ok, msg = await reject_delivery(human_task_id, comment, operator_id=user_id)
if ok:
return _json.dumps({"success": True, "message": msg}, ensure_ascii=False)
return _json.dumps({"success": False, "error": msg}, ensure_ascii=False)