fix(agent): redirect to blank page when navigating home from model page

This commit is contained in:
Zhu,JW
2025-11-24 11:22:03 +08:00
parent 79ee33be7c
commit 898c0988db
6 changed files with 39 additions and 4 deletions

View File

@@ -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({