feat: artifacts
This commit is contained in:
@@ -16,6 +16,19 @@ export type RenderOutputCacheEntry = {
|
||||
label: string
|
||||
type: 'image' | 'html'
|
||||
content: string
|
||||
/** Timestamp (ms) when this entry was last updated. */
|
||||
updatedAt?: number
|
||||
}
|
||||
|
||||
/** Returns a short "time since" string for display (e.g. "Just now", "2 min ago"). */
|
||||
export function formatTimeSinceLastUpdate(updatedAt: number | undefined): string {
|
||||
if (updatedAt == null || typeof updatedAt !== 'number') return ''
|
||||
const delta = Date.now() - updatedAt
|
||||
if (delta < 15_000) return 'Just now'
|
||||
if (delta < 60_000) return `${Math.round(delta / 1000)}s ago`
|
||||
if (delta < 3600_000) return `${Math.round(delta / 60_000)} min ago`
|
||||
if (delta < 86400_000) return `${Math.round(delta / 3600_000)}h ago`
|
||||
return `${Math.round(delta / 86400_000)}d ago`
|
||||
}
|
||||
|
||||
export const RECOLLECTION_FILE_EXT = '.zui.json'
|
||||
|
||||
Reference in New Issue
Block a user