fix(regulatory): 修复条件确认实时轮询和重复提示
This commit is contained in:
@@ -649,12 +649,14 @@
|
||||
return;
|
||||
}
|
||||
var cardId = "condition-confirmation-" + confirmation.batch_id;
|
||||
removeStaleConditionConfirmationCards(cardId);
|
||||
if (document.getElementById(cardId)) {
|
||||
return;
|
||||
}
|
||||
var article = document.createElement("article");
|
||||
article.className = "message assistant";
|
||||
article.id = cardId;
|
||||
article.setAttribute("data-condition-confirmation-card", "");
|
||||
article.setAttribute("data-node-label", "AI 适用条件确认");
|
||||
|
||||
var avatar = document.createElement("div");
|
||||
@@ -687,6 +689,14 @@
|
||||
scrollChatToBottom();
|
||||
}
|
||||
|
||||
function removeStaleConditionConfirmationCards(activeCardId) {
|
||||
document.querySelectorAll("[data-condition-confirmation-card]").forEach(function (card) {
|
||||
if (card.id !== activeCardId) {
|
||||
card.remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function renderConditionFields(candidates) {
|
||||
var html = "";
|
||||
Object.keys(candidates || {}).forEach(function (field) {
|
||||
@@ -830,9 +840,9 @@
|
||||
delete workflowPollingTimers[key];
|
||||
}
|
||||
|
||||
function startWorkflowPolling(batchId) {
|
||||
function startWorkflowPolling(batchId, workflow_type) {
|
||||
var card = workflowCardList ? workflowCardList.querySelector('[data-batch-id="' + batchId + '"]') : null;
|
||||
var workflow_type = card ? card.getAttribute("data-workflow-type") || "file_summary" : "file_summary";
|
||||
workflow_type = workflow_type || (card ? card.getAttribute("data-workflow-type") || "file_summary" : "file_summary");
|
||||
var key = workflowTimerKey(batchId, workflow_type);
|
||||
if (!batchId || workflowPollingTimers[key]) {
|
||||
return;
|
||||
@@ -907,7 +917,7 @@
|
||||
status.textContent = "已确认,工作流继续执行。";
|
||||
}
|
||||
form.classList.add("confirmed");
|
||||
startWorkflowPolling(batchId);
|
||||
startWorkflowPolling(batchId, "regulatory_review");
|
||||
await refreshWorkflowCard(batchId, "regulatory_review");
|
||||
} catch (error) {
|
||||
if (status) {
|
||||
@@ -1050,7 +1060,7 @@
|
||||
assistantMessage.text.innerHTML = renderAssistantContent(assistantText);
|
||||
} else if (eventName === "workflow_started") {
|
||||
ensureWorkflowCard(payload);
|
||||
startWorkflowPolling(payload.batch_id);
|
||||
startWorkflowPolling(payload.batch_id, payload.workflow_type);
|
||||
} else if (eventName === "done") {
|
||||
if (payload.assistant_message_id) {
|
||||
assistantMessage.article.id = "message-" + payload.assistant_message_id;
|
||||
|
||||
Reference in New Issue
Block a user