@@ -746,7 +746,10 @@ <h2 class="text-xs font-semibold text-[#94A3B8] uppercase tracking-wide">Chats</
746746 @dblclick ="editingChatId = chat.id; editingName = chat.name "
747747 x-text ="chat.name || 'New Chat' "
748748 > </ div >
749- < div class ="text-[10px] text-[#94A3B8] truncate " x-text ="getLastMessagePreview(chat) "> </ div >
749+ < div class ="flex items-center gap-1.5 ">
750+ < div class ="text-[10px] text-[#94A3B8] truncate " x-text ="getLastMessagePreview(chat) "> </ div >
751+ < span class ="text-[9px] text-[#94A3B8]/60 " x-text ="formatChatDate(chat.updatedAt || chat.createdAt) "> </ span >
752+ </ div >
750753 </ div >
751754 </ div >
752755 </ template >
@@ -1560,6 +1563,30 @@ <h3 class="text-xl font-semibold text-gray-900 dark:text-white">{{ $model }}</h3
15601563 const text = tempDiv . textContent || tempDiv . innerText || '' ;
15611564 return text . substring ( 0 , 40 ) + ( text . length > 40 ? '...' : '' ) ;
15621565 } ;
1566+
1567+ // Format chat date for display
1568+ window . formatChatDate = ( timestamp ) => {
1569+ if ( ! timestamp ) return '' ;
1570+ const date = new Date ( timestamp ) ;
1571+ const now = new Date ( ) ;
1572+ const diffMs = now - date ;
1573+ const diffMins = Math . floor ( diffMs / 60000 ) ;
1574+ const diffHours = Math . floor ( diffMs / 3600000 ) ;
1575+ const diffDays = Math . floor ( diffMs / 86400000 ) ;
1576+
1577+ if ( diffMins < 1 ) {
1578+ return 'Just now' ;
1579+ } else if ( diffMins < 60 ) {
1580+ return `${ diffMins } m ago` ;
1581+ } else if ( diffHours < 24 ) {
1582+ return `${ diffHours } h ago` ;
1583+ } else if ( diffDays < 7 ) {
1584+ return `${ diffDays } d ago` ;
1585+ } else {
1586+ // Show date for older chats
1587+ return date . toLocaleDateString ( 'en-US' , { month : 'short' , day : 'numeric' } ) ;
1588+ }
1589+ } ;
15631590 } ) ;
15641591
15651592 // Context size is now initialized in the Alpine store initialization above
0 commit comments