diff --git a/src/ui/components/chat/message-card.tsx b/src/ui/components/chat/message-card.tsx index 5845d6b6..e4d18cd9 100644 --- a/src/ui/components/chat/message-card.tsx +++ b/src/ui/components/chat/message-card.tsx @@ -13,6 +13,7 @@ import { Separator } from '@/ui/components/ui/separator' import { useQuery } from '@tanstack/react-query' import { Download, File, Terminal } from 'lucide-react' import React from 'react' +import { formatTimeAgo } from '@/ui/lib/time' import Markdown from 'react-markdown' import { Avatar, AvatarFallback } from '../ui/avatar' import { Skeleton } from '../ui/skeleton' @@ -281,10 +282,13 @@ export const MessageCard: React.FC = ({ const piEntry = entry.entry as Record | null const timestampStr = piEntry?.timestamp || (entry as Record).timestamp - const timestamp = - typeof timestampStr === 'string' || typeof timestampStr === 'number' - ? new Date(timestampStr).toLocaleTimeString() - : '' + let timestamp = '' + if (typeof timestampStr === 'string' || typeof timestampStr === 'number') { + const dateObj = new Date(timestampStr) + if (!isNaN(dateObj.getTime())) { + timestamp = formatTimeAgo(dateObj.toISOString()) + } + } if (piEntry && typeof piEntry === 'object') { if (piEntry.type === 'message' && piEntry.message) { @@ -329,7 +333,7 @@ export const MessageCard: React.FC = ({ ) { const obj = parsedArgs as Record return ( -
+
{Object.entries(obj).map(([key, value]) => { let valueStr = '' if (value && typeof value === 'object') { @@ -416,14 +420,13 @@ export const MessageCard: React.FC = ({ renderedBlocks.push(
- Calling Tool:{' '} {toolName}
{!!toolArgs && ( -
+
Arguments