Skip to content

Agent Zero AI framework

step expansion fix and timeout

3clyp5091304a58d5d9
diff --git a/webui/components/messages/process-group/process-group-store.js b/webui/components/messages/process-group/process-group-store.js
index b85dd93f3..56a18a683 100644
--- a/webui/components/messages/process-group/process-group-store.js
+++ b/webui/components/messages/process-group/process-group-store.js
@@ -1,4 +1,5 @@
import { createStore } from "/js/AlpineStore.js";
+import { store as preferencesStore } from "/components/sidebar/bottom/preferences/preferences-store.js";
// Process Group Store - manages collapsible process groups in chat
@@ -179,7 +180,7 @@ const model = {
// Get current detail mode from preferences
_getDetailMode() {
- return window.Alpine?.store("preferences")?.detailMode || "current";
+ return preferencesStore.detailMode || "current";
},
expandGroup(groupId, isActiveAndGenerating = false) {
@@ -203,7 +204,7 @@ const model = {
// Apply current mode to all existing DOM elements
applyModeSteps() {
const mode = this._getDetailMode();
- const showUtils = window.Alpine?.store("preferences")?.showUtils || false;
+ const showUtils = preferencesStore.showUtils || false;
const allGroups = document.querySelectorAll(".process-group");
// Find the last VISIBLE step using targeted selector
diff --git a/webui/index.js b/webui/index.js
index bd3bd37ff..96b1cf388 100644
--- a/webui/index.js
+++ b/webui/index.js
@@ -415,8 +415,6 @@ function afterMessagesUpdate(logs) {
if (localStorage.getItem("speech") == "true") {
speakMessages(logs);
}
- // Apply messages expansion mode after rendering
- processGroupStore.applyModeSteps();
}
function speakMessages(logs) {
diff --git a/webui/js/messages.js b/webui/js/messages.js
index f1254921f..19a8f3b8f 100644
--- a/webui/js/messages.js
+++ b/webui/js/messages.js
@@ -852,7 +852,7 @@ export function drawMessageError(
messageDiv.appendChild(errorGroup);
// Check detail mode and expand if needed
- const detailMode = window.Alpine?.store("preferences")?.detailMode || "current";
+ const detailMode = preferencesStore.detailMode || "current";
if (detailMode === "current" || detailMode === "expanded") {
errorGroup.classList.add("expanded");
}
@@ -1426,19 +1426,27 @@ function addProcessStep(group, id, type, heading, content, kvps, timestamp = nul
// Get step info from heading (single source of truth: backend)
const title = getStepTitle(heading, kvps, type);
- // Check if step should be expanded
- const isActiveStep = !isGroupCompleted && group.id === activeProcessGroupId;
- const isStepExpanded = processGroupStore.expandStep(groupId, id, isActiveStep);
-
- // In "current" mode, collapse all other steps
+ // Determine if this new step should be expanded
const detailMode = preferencesStore.detailMode;
- if (detailMode === "current" && isStepExpanded) {
- document.querySelectorAll(".process-step.step-expanded").forEach(s => {
- s.classList.remove("step-expanded");
- });
+ let shouldExpand = false;
+
+ if (detailMode === "expanded") {
+ shouldExpand = true;
+ } else if (detailMode === "current" && !isGroupCompleted) {
+ // In "current" mode: expand new step, delay-collapse previous
+ shouldExpand = true;
+
+ // Find the currently expanded step (the previous one) to collapse after delay
+ const previousExpandedStep = stepsContainer.querySelector(".process-step.step-expanded");
+ if (previousExpandedStep) {
+ setTimeout(() => {
+ previousExpandedStep.classList.remove("step-expanded");
+ }, 2000);
+ }
}
+ // In "collapsed" mode: shouldExpand stays false
- if (isStepExpanded) {
+ if (shouldExpand) {
step.classList.add("step-expanded");
}
@@ -2165,6 +2173,14 @@ function markProcessGroupComplete(group, responseTitle) {
// Add completed class to group
group.classList.add("process-group-completed");
+ // Collapse the last expanded step when processing is done (in "current" mode)
+ const detailMode = preferencesStore.detailMode;
+ if (detailMode === "current") {
+ const expandedStep = group.querySelector(".process-step.step-expanded");
+ if (expandedStep) {
+ expandedStep.classList.remove("step-expanded");
+ }
+ }
// Calculate final duration from backend data (sum of all step durations)
const steps = group.querySelectorAll(".process-step");