import { useEffect, useMemo, useState } from 'react'; import { ArrowRightOutlined, CompassOutlined, DeleteOutlined, EditOutlined, MessageOutlined, RobotOutlined } from '@ant-design/icons'; import { Button, Col, Row, Empty, Popconfirm, App as AntApp, Tag, Space } from 'antd'; import { Link, useNavigate } from 'react-router-dom'; import dayjs from 'dayjs'; import { Agent, AgentAPI } from '../api'; export default function AgentList() { const [list, setList] = useState([]); const [loading, setLoading] = useState(false); const navigate = useNavigate(); const { message } = AntApp.useApp(); const load = async () => { setLoading(true); try { setList(await AgentAPI.list()); } finally { setLoading(false); } }; useEffect(() => { load(); }, []); const handleDelete = async (id: string) => { await AgentAPI.remove(id); message.success('已删除'); load(); }; const isImageUrl = (url: string) => url?.startsWith('http') || url?.startsWith('/'); const publicCount = useMemo(() => list.filter((a) => a.visibility === 'public').length, [list]); const teamCount = useMemo(() => list.filter((a) => a.visibility === 'team').length, [list]); return (
我的 Agent 资产

我的智能体

把你的 AI 助手沉淀成一组可管理、可协作、可持续进化的能力单元。创建入口统一在智能体广场,这里负责查看、进入和运营它们。
{[ { label: '已创建智能体', value: list.length, tone: 'rgba(8, 145, 178, 0.10)', color: 'var(--color-brand)' }, { label: '公开可分享', value: publicCount, tone: 'rgba(34, 197, 94, 0.10)', color: 'var(--color-success)' }, { label: '团队协作中', value: teamCount, tone: 'rgba(14, 165, 233, 0.10)', color: 'var(--color-info)' } ].map((item) => (
{item.label}
{item.value} 实时统计
))}
{!loading && list.length === 0 ? (
) : ( {list.map((a) => (
{isImageUrl(a.avatar) ? ( avatar ) : ( (a.name?.charAt(0) || '?').toUpperCase() )}
{a.name}
最近更新于 {dayjs(a.updated_at).format('YYYY-MM-DD')}
{a.description || '还没有填写描述,可以补充这个智能体适合解决什么问题。'}
{a.visibility === 'public' && ( 公开 )} {a.visibility === 'team' && ( 团队 )} {a.visibility === 'private' && ( 私有 )} {a.model && ( {a.model} )} T={a.temperature} {(a.fork_count ?? 0) > 0 && ( Fork {a.fork_count} )}
handleDelete(a.id)} okText="删除" cancelText="取消" >
))}
)} {list.length > 0 && (
想创建新的智能体入口?
统一从智能体广场进入,保证创建流程和发现体验保持一致。
)}
); }