diff --git a/src/App.tsx b/src/App.tsx index eaf6202..27d9203 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -31,6 +31,7 @@ const UserManagement = lazy(() => import('./pages/UserManagement')) const MemberManagement = lazy(() => import('./pages/MemberManagement')) const ImportMonitorPage = lazy(() => import('./pages/ImportMonitor')) const KnowledgeOpsPage = lazy(() => import('./pages/KnowledgeOps')) +const ChatLogsPage = lazy(() => import('./pages/ChatLogs')) const HermesSettings = lazy(() => import('./pages/HermesSettings')) const TaskAssistant = lazy(() => import('./pages/TaskAssistant')) const Placeholder = lazy(() => import('./pages/Placeholder')) @@ -102,6 +103,7 @@ function App() { }>} /> } /> }>} /> + }>} /> }>} /> }>} /> (null) + + const { data: sessions, isLoading } = useQuery({ + queryKey: ['chat-logs', 'sessions'], + queryFn: (): Promise => api.get('/admin-api/rag-chat/sessions'), + staleTime: 10_000, + }) + + const { data: messages } = useQuery({ + queryKey: ['chat-logs', 'messages', selectedSession?.id], + queryFn: (): Promise => api.get(`/admin-api/rag-chat/sessions/${selectedSession?.id}/messages`), + enabled: !!selectedSession?.id, + }) + + const msgCols = [ + { title: '角色', dataIndex: 'role', width: 70, render: (r: string) => {r==='user'?'用户':'AI'} }, + { title: '内容', dataIndex: 'content', ellipsis: true, render: (v: string) => {v?.slice(0, 300)} }, + { title: 'Tokens', dataIndex: 'tokens', width: 70, align: 'center' as const }, + { title: '时间', dataIndex: 'createdAt', width: 130, render: (d: string) => dayjs(d).format('HH:mm:ss') }, + ] + + return ( +
+
+ <MessageOutlined /> 对话日志 + +
+ dayjs(d).format('MM-DD HH:mm') }, + { + title: '操作', width: 70, + render: (_: any, r: any) => ( + + ), + }, + ]} + /> + setDrawerOpen(false)} width={700}> +
+ + + ) +}