feat(frontend): Allow duplicate progress steps to support cyclical worker loops and retries

This commit is contained in:
Yunxiao Xu
2026-02-23 18:01:17 -08:00
parent 8fcfc4ee88
commit b9084fcaef

View File

@@ -185,9 +185,11 @@ export const ChatService = {
const lastMsg = { ...newMessages[lastMsgIndex] } const lastMsg = { ...newMessages[lastMsgIndex] }
if (lastMsg && lastMsg.role === "assistant") { if (lastMsg && lastMsg.role === "assistant") {
// Avoid duplicate start messages const currentSteps = lastMsg.steps || []
if (!(lastMsg.steps || []).includes(startStatusMap[name])) { // Allow duplicate steps if it's a retry (cycle),
lastMsg.steps = [...(lastMsg.steps || []), startStatusMap[name]] // but avoid spamming the same active step multiple times in a row
if (currentSteps[currentSteps.length - 1] !== startStatusMap[name]) {
lastMsg.steps = [...currentSteps, startStatusMap[name]]
newMessages[lastMsgIndex] = lastMsg newMessages[lastMsgIndex] = lastMsg
return newMessages return newMessages
} }