ragflow/web/src/pages/home/agent-list.tsx
balibabu 757c5376be
Fix: Fixed the issue where the agent and chat cards on the home page could not be deleted #3221 (#9864)
### What problem does this PR solve?

Fix: Fixed the issue where the agent and chat cards on the home page
could not be deleted #3221

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
2025-09-02 11:10:57 +08:00

48 lines
1.4 KiB
TypeScript

import { MoreButton } from '@/components/more-button';
import { RenameDialog } from '@/components/rename-dialog';
import { useNavigatePage } from '@/hooks/logic-hooks/navigate-hooks';
import { useFetchAgentListByPage } from '@/hooks/use-agent-request';
import { AgentDropdown } from '../agents/agent-dropdown';
import { useRenameAgent } from '../agents/use-rename-agent';
import { ApplicationCard } from './application-card';
export function Agents() {
const { data } = useFetchAgentListByPage();
const { navigateToAgent } = useNavigatePage();
const {
agentRenameLoading,
initialAgentName,
onAgentRenameOk,
agentRenameVisible,
hideAgentRenameModal,
showAgentRenameModal,
} = useRenameAgent();
return (
<>
{data.slice(0, 10).map((x) => (
<ApplicationCard
key={x.id}
app={x}
onClick={navigateToAgent(x.id)}
moreDropdown={
<AgentDropdown
showAgentRenameModal={showAgentRenameModal}
agent={x}
>
<MoreButton></MoreButton>
</AgentDropdown>
}
></ApplicationCard>
))}
{agentRenameVisible && (
<RenameDialog
hideModal={hideAgentRenameModal}
onOk={onAgentRenameOk}
initialName={initialAgentName}
loading={agentRenameLoading}
></RenameDialog>
)}
</>
);
}