Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions ui/src/components/sidebars/ChatItem.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const ShortTitle: Story = {
agentNamespace: "kagent",
onDelete: async () => {},
sessionName: "Quick question",
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
},
};

Expand All @@ -73,7 +73,7 @@ export const LongTitle: Story = {
agentNamespace: "kagent",
onDelete: async () => {},
sessionName: "Review https://github.com/Smartest-Fly/app/pull/1234 and provide feedback on the authentication implementation",
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
},
};

Expand All @@ -84,7 +84,7 @@ export const LongTitleWithAgentName: Story = {
agentNamespace: "kagent",
onDelete: async () => {},
sessionName: "Review https://github.com/Smartest-Fly/app/pull/1234 and provide feedback on the authentication implementation",
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
},
};

Expand All @@ -107,7 +107,7 @@ export const MultipleLongTitles: Story = {
agentNamespace="kagent"
onDelete={async () => {}}
sessionName={title}
createdAt={new Date(Date.now() - i * 3600000).toISOString()}
updatedAt={new Date(Date.now() - i * 3600000).toISOString()}

/>
))}
Expand Down
6 changes: 3 additions & 3 deletions ui/src/components/sidebars/ChatItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ interface ChatItemProps {
agentNamespace?: string;
sessionName?: string;
onDownload?: (sessionId: string) => Promise<void>;
createdAt?: string;
updatedAt?: string;
}

const ChatItem = ({ sessionId, agentName, agentNamespace, onDelete, sessionName, onDownload, createdAt }: ChatItemProps) => {
const ChatItem = ({ sessionId, agentName, agentNamespace, onDelete, sessionName, onDownload, updatedAt }: ChatItemProps) => {
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: The ChatItem component's prop has been changed from createdAt to updatedAt, but the Storybook stories file (ChatItem.stories.tsx) still references the old createdAt prop in 4 places (lines 65, 76, 87, and 110). This file will need to be updated separately to reflect the prop name change.

Copilot uses AI. Check for mistakes.
const title = sessionName || "Untitled";

// Format timestamp based on how recent it is
Expand Down Expand Up @@ -58,7 +58,7 @@ const ChatItem = ({ sessionId, agentName, agentNamespace, onDelete, sessionName,
style={{
background: 'linear-gradient(to right, transparent, hsl(var(--sidebar-background)) 30%)',
}}
>{formatTime(createdAt)}</span>
>{formatTime(updatedAt)}</span>
</Link>
</SidebarMenuButton>
<DropdownMenu modal={false}>
Expand Down
6 changes: 3 additions & 3 deletions ui/src/components/sidebars/GroupedChats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ export default function GroupedChats({ agentName, agentNamespace, sessions }: Gr
older: [],
};

// Process each session and group by date
// Process each session and group by last activity date (updated_at)
localSessions.forEach(session => {
const date = new Date(session.created_at);
const date = new Date(session.updated_at || session.created_at);
if (isToday(date)) {
groups.today.push(session);
} else if (isYesterday(date)) {
Expand All @@ -50,7 +50,7 @@ export default function GroupedChats({ agentName, agentNamespace, sessions }: Gr
const sortChats = (sessions: Session[]) =>
sessions.sort((a, b) => {
const getLatestTimestamp = (session: Session) => {
return new Date(session.created_at).getTime();
return new Date(session.updated_at || session.created_at).getTime();
};

return getLatestTimestamp(b) - getLatestTimestamp(a);
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/sidebars/SessionGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const ChatGroup = ({ title, sessions, onDeleteSession, onDownloadSession, agentN
<CollapsibleContent>
<SidebarMenuSub className="mx-0 px-0 ml-2 pl-2">
{sessions.map((session) => (
<ChatItem key={session.id} sessionId={session.id!} agentName={agentName} agentNamespace={agentNamespace} onDelete={onDeleteSession} sessionName={session.name} onDownload={onDownloadSession} createdAt={session.created_at} />
<ChatItem key={session.id} sessionId={session.id!} agentName={agentName} agentNamespace={agentNamespace} onDelete={onDeleteSession} sessionName={session.name} onDownload={onDownloadSession} updatedAt={session.updated_at || session.created_at} />
))}
</SidebarMenuSub>
</CollapsibleContent>
Expand Down
Loading