mirror of
https://github.com/agent0ai/agent-zero.git
synced 2026-10-21 04:40:13 +00:00
timestamp log fix
This commit is contained in:
parent
ea078affac
commit
7dcfd6af6a
2 changed files with 9 additions and 6 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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`;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue