cumulative step count per context
3clyp50 committed
Jan 19, 2026 at 04:34 UTC
c57d228683973cfb5769acc72211bf325c6bad88
1 file changed
+13
-3
webui/js/messages.js
+13
-3
@@ -1833,11 +1833,21 @@ function updateProcessGroupHeader(group) {
1833
}
1834
}
1835
1836
- // Update step count in metrics - only count GEN (agent) steps
1836
+ // Update step count in metrics - cumulative GEN steps across all process groups up to this one
1837
const stepsMetricEl = metricsEl?.querySelector(".metric-steps .metric-value");
1838
if (stepsMetricEl) {
1839
- const genSteps = Array.from(steps).filter(step => step.getAttribute("data-type") === "agent");
1840
- stepsMetricEl.textContent = genSteps.length.toString();
1839
+ // Get all process groups in chat history
1840
+ const allGroups = Array.from(chatHistory.querySelectorAll(".process-group"));
1841
+ const currentGroupIndex = allGroups.indexOf(group);
1842
+
1843
+ // Count GEN steps from all groups up to and including this one
1844
+ let cumulativeGenSteps = 0;
1845
+ for (let i = 0; i <= currentGroupIndex; i++) {
1846
+ const groupGenSteps = allGroups[i].querySelectorAll('.process-step[data-type="agent"]');
1847
+ cumulativeGenSteps += groupGenSteps.length;
1848
+ }
1849
+
1850
+ stepsMetricEl.textContent = cumulativeGenSteps.toString();
1851
}
1852
1853
// Update time metric