Merge branch 'cv-main'

This commit is contained in:
xintaofei
2026-04-24 10:05:36 +08:00

View File

@@ -335,6 +335,7 @@ interface FolderGroupItemProps {
folderId: number folderId: number
folderName: string folderName: string
conversations: DbConversationSummary[] conversations: DbConversationSummary[]
totalConversationCount: number
expanded: boolean expanded: boolean
importing: boolean importing: boolean
reordering: boolean reordering: boolean
@@ -367,6 +368,7 @@ function FolderGroupItem({
folderId, folderId,
folderName, folderName,
conversations, conversations,
totalConversationCount,
expanded, expanded,
importing, importing,
reordering, reordering,
@@ -456,27 +458,40 @@ function FolderGroupItem({
/> />
</div> </div>
{expanded && {expanded &&
conversations.map((conv) => ( (conversations.length === 0 ? (
<SidebarConversationCard <div
key={`conv-${conv.agent_type}-${conv.id}`} className="py-[0.375rem] text-[0.75rem] text-muted-foreground/70"
conversation={conv} style={{
isSelected={ paddingLeft: "calc(var(--conv-rail-axis) + 0.875rem)",
selectedConversation?.agentType === conv.agent_type && }}
selectedConversation?.id === conv.id >
} {totalConversationCount === 0
isOpenInTab={openTabConversationKeys.has( ? t("emptyFolderHint")
`${conv.agent_type}:${conv.id}` : t("noMatchingConversations")}
)} </div>
timeLabel={formatRelative( ) : (
sortMode === "updated" ? conv.updated_at : conv.created_at conversations.map((conv) => (
)} <SidebarConversationCard
onSelect={onSelect} key={`conv-${conv.agent_type}-${conv.id}`}
onDoubleClick={onDoubleClick} conversation={conv}
onRename={onRename} isSelected={
onDelete={onDelete} selectedConversation?.agentType === conv.agent_type &&
onStatusChange={onStatusChange} selectedConversation?.id === conv.id
onNewConversation={onNewConversation} }
/> isOpenInTab={openTabConversationKeys.has(
`${conv.agent_type}:${conv.id}`
)}
timeLabel={formatRelative(
sortMode === "updated" ? conv.updated_at : conv.created_at
)}
onSelect={onSelect}
onDoubleClick={onDoubleClick}
onRename={onRename}
onDelete={onDelete}
onStatusChange={onStatusChange}
onNewConversation={onNewConversation}
/>
))
))} ))}
</Reorder.Item> </Reorder.Item>
</div> </div>
@@ -619,6 +634,14 @@ export function SidebarConversationList({
return map return map
}, [filteredConversations, sortMode]) }, [filteredConversations, sortMode])
const folderTotalCounts = useMemo(() => {
const map = new Map<number, number>()
for (const conv of conversations) {
map.set(conv.folder_id, (map.get(conv.folder_id) ?? 0) + 1)
}
return map
}, [conversations])
const orderedFolderIds = useMemo(() => { const orderedFolderIds = useMemo(() => {
const folderIdSet = new Set(folders.map((f) => f.id)) const folderIdSet = new Set(folders.map((f) => f.id))
// During drag we honour the optimistic order so sibling folders shift live // During drag we honour the optimistic order so sibling folders shift live
@@ -1036,6 +1059,9 @@ export function SidebarConversationList({
folderId={folderId} folderId={folderId}
folderName={folderName} folderName={folderName}
conversations={convsWithKey} conversations={convsWithKey}
totalConversationCount={
folderTotalCounts.get(folderId) ?? 0
}
expanded={expanded} expanded={expanded}
importing={importing} importing={importing}
reordering={reordering} reordering={reordering}