/* Copyright (C) 2025 QuantumNous This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import React, { useMemo } from 'react'; import { ArrowUpRight, Clock, Inbox } from 'lucide-react'; import { renderQuota, renderNumber, timestamp2string } from '../../helpers'; const isSuccess = (l) => l?.type === 0 || l?.status === 0 || l?.type === 'success' || l?.type === undefined; const RecentActivity = ({ logs = [], className = '' }) => { const recent = useMemo(() => logs.slice(0, 10), [logs]); return (
最近调用
共{' '} {recent.length} {' '} 条记录
查看全部
{recent.length === 0 ? (

暂无使用记录

开始使用 API 后,您的使用历史将显示在这里

) : (
{recent.map((l) => { const ok = isSuccess(l); return ( ); })}
time model tokens cost status
{timestamp2string(l.created_at).slice(5, 16)} {l.model_name || '—'} {renderNumber(l.token_used || 0)} {renderQuota(l.quota || 0)} {ok ? '成功' : '失败'}
)}
); }; export default RecentActivity;