Skip to content

Agent Zero AI framework

timestamp log fix

3clyp507dcfd6af6a36
diff --git a/python/helpers/log.py b/python/helpers/log.py
index 9b737f076..4842d07d2 100644
--- a/python/helpers/log.py
+++ b/python/helpers/log.py
@@ -137,8 +137,8 @@ class LogItem:
agent_number: int = 0 # Agent number (0 = main agent, 1+ = subordinate agents)
def __post_init__(self):
- self.guid = self.log.guid
- self.timestamp = time.time()
+ self.guid = self.guid or self.log.guid
+ self.timestamp = self.timestamp or time.time()
def update(
self,
diff --git a/webui/js/time-utils.js b/webui/js/time-utils.js
index 4f74f00ca..0850ff04f 100644
--- a/webui/js/time-utils.js
+++ b/webui/js/time-utils.js
@@ -78,11 +78,14 @@ export function getUserTimezone() {
export function formatDuration(durationMs) {
if (durationMs == null || durationMs < 0) return '0s';
- if (durationMs < 60000) {
- return `${Math.round(durationMs / 1000)}s`;
+ // Round total seconds first to avoid "1m60s" when seconds round up to 60
+ const totalSecs = Math.round(durationMs / 1000);
+
+ if (totalSecs < 60) {
+ return `${totalSecs}s`;
}
- const mins = Math.floor(durationMs / 60000);
- const secs = Math.round((durationMs % 60000) / 1000);
+ const mins = Math.floor(totalSecs / 60);
+ const secs = totalSecs % 60;
return `${mins}m${secs}s`;
}