feat(regulatory): 增加适用条件确认暂停恢复

This commit is contained in:
2026-06-07 09:19:31 +08:00
parent bd805203f1
commit bbd2d3532a
12 changed files with 535 additions and 1 deletions

View File

@@ -796,6 +796,60 @@
});
}
function bindConditionConfirmForms() {
document.querySelectorAll("[data-condition-confirm-form]").forEach(function (form) {
if (form.dataset.bound === "true") {
return;
}
form.dataset.bound = "true";
form.addEventListener("submit", async function (event) {
event.preventDefault();
var batchId = form.getAttribute("data-batch-id");
var status = form.querySelector("[data-condition-confirm-status]");
var submitButton = form.querySelector('button[type="submit"]');
var formData = new FormData(form);
var conditions = {};
formData.forEach(function (value, key) {
if (key !== "csrfmiddlewaretoken") {
conditions[key] = value;
}
});
if (submitButton) {
submitButton.disabled = true;
}
if (status) {
status.textContent = "正在恢复法规核查...";
}
try {
var response = await fetch(form.getAttribute("data-confirm-url"), {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-CSRFToken": formData.get("csrfmiddlewaretoken"),
},
body: JSON.stringify({ conditions: conditions }),
});
if (!response.ok) {
throw new Error("确认失败。");
}
if (status) {
status.textContent = "已确认,工作流继续执行。";
}
form.classList.add("confirmed");
startWorkflowPolling(batchId);
await refreshWorkflowCard(batchId, "regulatory_review");
} catch (error) {
if (status) {
status.textContent = "确认失败,请稍后重试。";
}
if (submitButton) {
submitButton.disabled = false;
}
}
});
});
}
async function streamChat(event) {
event.preventDefault();
if (!composer || !promptInput || !sendButton || !chatStage) {
@@ -955,6 +1009,7 @@
renderExistingAssistantMessages();
refreshWorkflowBatchCarousel(0);
bindWorkflowBatchCarouselControls();
bindConditionConfirmForms();
refreshRunningWorkflowCards();
if (chatScroll) {