diff --git a/pipeline_service/kb_ingest_capability.py b/pipeline_service/kb_ingest_capability.py index 15d4cd2..f4d45af 100644 --- a/pipeline_service/kb_ingest_capability.py +++ b/pipeline_service/kb_ingest_capability.py @@ -169,14 +169,15 @@ async def decide_kb_ingest(suggestion_id, approve, operator_id, comment=""): if owner and str(operator_id) != str(owner): return False, "仅项目 owner 可批准/驳回入库建议" - # 关联人工待办置为已处理(避免待办重复出现) + # 关联人工待办置为已处理(避免待办重复出现)——用 form_schema 里唯一的 + # suggestion_id 精确匹配(description LIKE 文件名会误伤同名文件的待办) await sor.sqlExe( "UPDATE pipeline_human_tasks SET status='done', submitted_by=${o}$, submitted_at=NOW(), " "result_data=${rd}$ WHERE task_type='kb_ingest_confirm' AND status='pending' " - "AND description LIKE ${pat}$", + "AND form_schema LIKE ${pat}$", {"o": operator_id, "rd": json.dumps({"suggestion_id": suggestion_id, "approve": bool(approve)}, ensure_ascii=False), - "pat": "%" + str(sg.get("file_name", "")) + "%"}) + "pat": "%\"suggestion_id\": \"" + str(suggestion_id) + "\"%"}) await sor.sqlExe("COMMIT", {}) if not approve: