fix(agent): redirect to blank page when navigating home from model page
This commit is contained in:
@@ -17,7 +17,6 @@ import EditAgentDialog from './components/EditAgentDialog';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useDialog } from '@/hooks/useDialog';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
|
||||
function AgentListPage() {
|
||||
const [searchValue, setSearchValue] = useState('');
|
||||
const [createOpen, setCreateOpen] = useState(false);
|
||||
@@ -31,6 +30,7 @@ function AgentListPage() {
|
||||
pageSize,
|
||||
setCurrentPage,
|
||||
setKeywords,
|
||||
checkDefaultModel,
|
||||
refresh,
|
||||
} = useAgentList({ page: 1, page_size: 10 });
|
||||
|
||||
@@ -40,8 +40,8 @@ function AgentListPage() {
|
||||
const ops = useAgentOperations();
|
||||
|
||||
const totalPages = useMemo(() => {
|
||||
return Math.ceil((agents?.length || 0) / pageSize) || 1;
|
||||
}, [agents, pageSize]);
|
||||
return Math.ceil((total || 0) / pageSize) || 1;
|
||||
}, [total, pageSize]);
|
||||
|
||||
const currentPageData = useMemo(() => {
|
||||
const startIndex = (currentPage - 1) * pageSize;
|
||||
@@ -108,7 +108,7 @@ function AgentListPage() {
|
||||
onCreateAgent={() => setCreateOpen(true)}
|
||||
onEdit={(agent) => { setEditTarget(agent); setEditOpen(true); }}
|
||||
onView={(agent) => {
|
||||
navigate(`/route-ragflow/agent/${agent.id}`);
|
||||
checkDefaultModel(agent.id);
|
||||
}}
|
||||
onDelete={async (agent) => {
|
||||
const confirmed = await dialog.confirm({
|
||||
|
||||
Reference in New Issue
Block a user