feat(todo-form): 人类任务通道接form_schema——两条待办通道(问题/人类任务)全产线通用动态表单

This commit is contained in:
ymq 2026-09-01 13:47:31 +08:00
parent 14cbf208b7
commit 8993a10106

View File

@ -83,11 +83,15 @@ async def _get_user_roles(sor, user_id):
async def create_human_task(project_id, title, description="", task_type=T_GENERAL,
assignee_role=None, assignee_id=None,
iteration_id=None, bug_id=None, created_by=None, task_id=""):
iteration_id=None, bug_id=None, created_by=None, task_id="",
form_schema=None):
"""派发项目级人类任务。assignee_role 或 assignee_id 至少指定一个。
task_id确认类任务绑定原引擎任务 id用于确认后继续派发/退回重做
返回 (True, human_task_id) (False, 错误信息)
form_schema动态表单声明可选与问题通道同格式待办详情按它渲染
上传/填写界面人类在待办里直接完成任务文件落项目工作空间路径进
result_data QC 与任务链消费
返回 (True, human_task_id) (False, 错误信息)
"""
if not project_id:
return False, "缺少 project_id"
@ -112,6 +116,7 @@ async def create_human_task(project_id, title, description="", task_type=T_GENER
iteration_id = getattr(it[0], 'id', '') if it else ''
hid = getID()
_fs_json = json.dumps(form_schema, ensure_ascii=False) if form_schema else None
await sor.C('pipeline_human_tasks', {
'id': hid,
'task_id': task_id or '', # 确认类任务绑定原引擎任务 id
@ -120,7 +125,7 @@ async def create_human_task(project_id, title, description="", task_type=T_GENER
'task_type': task_type or T_GENERAL,
'assignee_role': assignee_role or '',
'assignee_id': assignee_id or '',
'form_schema': None,
'form_schema': _fs_json,
'result_data': None,
'status': S_PENDING,
'submitted_by': created_by or '',