import { Button, Card, Input, Space, Typography } from '@arco-design/web-react' import { IconArrowUp, IconAttachment, IconPlusCircle, IconRobot, } from '@arco-design/web-react/icon' import type { AISession, ProjectWorkspace } from './project-types' const { Title, Text } = Typography export function ProjectAi({ activeWorkspace, onSelectItem }: { activeWorkspace: ProjectWorkspace; onSelectItem: (title: string) => void }) { const { aiSessions } = activeWorkspace const groupedSessions = groupSessions(aiSessions) return (
{groupedSessions.length ? ( groupedSessions.map((group) => (
{group.label} {group.items.map((session, index) => ( ))}
)) ) : ( 暂无对话 )}
选择专家,开始对话
) } function groupSessions(sessions: AISession[]) { const labels = ['今天', '昨天', '7 天内'] return labels.map((label) => ({ label, items: sessions.filter((session, index) => session.time.includes(label) || (!labels.some((item) => session.time.includes(item)) && labels.indexOf(label) === fallbackGroupIndex(index))), })).filter((group) => group.items.length > 0) } function fallbackGroupIndex(index: number) { if (index === 0) return 0 if (index === 1) return 1 return 2 }