Skip to content

Agent Zero AI framework

showThoughts hide/show GEN steps

3clyp50370509673965
diff --git a/webui/components/messages/process-group/process-group.css b/webui/components/messages/process-group/process-group.css
index 654eb9ff9..4387c4c2f 100644
--- a/webui/components/messages/process-group/process-group.css
+++ b/webui/components/messages/process-group/process-group.css
@@ -834,4 +834,5 @@
.process-step-detail-content pre.msg-json.show-json {
display: block;
+ margin-top: var(--spacing-xs);
}
diff --git a/webui/components/sidebar/bottom/preferences/preferences-store.js b/webui/components/sidebar/bottom/preferences/preferences-store.js
index 98735ff19..b709ccd8a 100644
--- a/webui/components/sidebar/bottom/preferences/preferences-store.js
+++ b/webui/components/sidebar/bottom/preferences/preferences-store.js
@@ -95,6 +95,14 @@ const model = {
this._collapseProcessGroups = true;
}
+ // Load show thoughts preference
+ try {
+ const storedShowThoughts = localStorage.getItem("showThoughts");
+ this._showThoughts = storedShowThoughts !== "false"; // Default true
+ } catch {
+ this._showThoughts = true;
+ }
+
// Apply all preferences
this._applyDarkMode(this._darkMode);
this._applyAutoScroll(this._autoScroll);
@@ -129,6 +137,8 @@ const model = {
},
_applyShowThoughts(value) {
+ localStorage.setItem("showThoughts", value);
+
// For original messages
css.toggleCssProperty(
".msg-thoughts",
@@ -139,6 +149,11 @@ const model = {
document.querySelectorAll(".step-kvp.msg-thoughts").forEach((el) => {
el.classList.toggle("hide-thoughts", !value);
});
+
+ // Toggle collapse/expand state for all GEN steps (agent type steps with thoughts)
+ document.querySelectorAll('.process-step[data-type="agent"]').forEach((el) => {
+ el.classList.toggle("step-expanded", value);
+ });
},
_applyShowJson(value) {
diff --git a/webui/js/messages.js b/webui/js/messages.js
index 0082dbf43..4a4537585 100644
--- a/webui/js/messages.js
+++ b/webui/js/messages.js
@@ -1215,7 +1215,9 @@ function addProcessStep(group, id, type, heading, content, kvps, timestamp = nul
const title = getStepTitle(heading, kvps, type);
// Check if step should be expanded
- const isStepExpanded = processGroupStore.isStepExpanded(groupId, id);
+ // Agent (GEN) steps expand based on showThoughts preference
+ const isStepExpanded = processGroupStore.isStepExpanded(groupId, id) ||
+ (type === "agent" && preferencesStore.showThoughts);
if (isStepExpanded) {
step.classList.add("step-expanded");
}
@@ -1419,22 +1421,7 @@ function renderStepDetailContent(container, content, kvps, type = null) {
// Special handling for thoughts/reasoning - render with single lightbulb icon
if (lowerKey === "thoughts" || lowerKey === "thinking" || lowerKey === "reflection" || lowerKey === "reasoning") {
- const thoughtsDiv = document.createElement("div");
- thoughtsDiv.classList.add("step-thoughts", "msg-thoughts");
-
- // Apply current preference state - hide if showThoughts is false
- if (!preferencesStore.showThoughts) {
- thoughtsDiv.classList.add("hide-thoughts");
- }
-
- const thoughtText = cleanTextValue(value);
-
- if (thoughtText) {
- // Single icon + text block
- thoughtsDiv.innerHTML = `<span class="thought-icon material-symbols-outlined">lightbulb</span><span class="thought-text">${escapeHTML(thoughtText)}</span>`;
- }
-
- kvpsDiv.appendChild(thoughtsDiv);
+ renderThoughts(kvpsDiv, value);
continue;
}