pipeline-bidding/wwwroot/api/tech_template_confirm.dspy

41 lines
1.9 KiB
Plaintext
Raw 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.

# tech_template_confirm.dspy - 技术方案书章节骨架的用户确认/驳回端点
# (纯技术方案流程 bid_tech_proposal,2026-09-15 批2收口)
#
# 入参(form-encoded):
# human_task_id 模版确认待办 id(pipeline_human_tasks.id,task_type=tech_template_confirm)
# decision confirm | reject
# comment 驳回意见(reject 时必填;confirm 可空)
#
# 安全:确认动作是用户专属(同机构校验在 bid_tech_capability.confirm_tech_template);
# agent 无对应工具,无法代替确认。确认后骨架落 bid_chapters(section=technical) 开写;
# 驳回意见存 result_data,对账器重派模版任务时注入(get_template_reject_comment)。
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()
decision = str((params_kw or {}).get('decision') or '').strip().lower()
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 decision not in ('confirm', 'reject'):
return _json.dumps({"success": False, "error": "decision 必须是 confirm 或 reject"},
ensure_ascii=False)
try:
from pipeline_bidding.bid_tech_capability import confirm_tech_template
except Exception as e:
return _json.dumps({"success": False,
"error": "投标产线技术能力模块不可用:%s" % str(e)[:150]},
ensure_ascii=False)
ok, msg = await confirm_tech_template(human_task_id, decision, 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)