From 757c5376bec8b27292fba73ccf3867f3a839e0cd Mon Sep 17 00:00:00 2001 From: balibabu Date: Tue, 2 Sep 2025 11:10:57 +0800 Subject: [PATCH] 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) --- web/src/pages/home/agent-list.tsx | 48 +++++++++++++++++---- web/src/pages/home/application-card.tsx | 11 +++-- web/src/pages/home/chat-list.tsx | 55 ++++++++++++++++++++----- 3 files changed, 90 insertions(+), 24 deletions(-) diff --git a/web/src/pages/home/agent-list.tsx b/web/src/pages/home/agent-list.tsx index 60e1a3c66..0f0d6d08f 100644 --- a/web/src/pages/home/agent-list.tsx +++ b/web/src/pages/home/agent-list.tsx @@ -1,18 +1,48 @@ +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) => ( - - )); + return ( + <> + {data.slice(0, 10).map((x) => ( + + + + } + > + ))} + {agentRenameVisible && ( + + )} + + ); } diff --git a/web/src/pages/home/application-card.tsx b/web/src/pages/home/application-card.tsx index 96aaed609..82f0c214a 100644 --- a/web/src/pages/home/application-card.tsx +++ b/web/src/pages/home/application-card.tsx @@ -1,4 +1,3 @@ -import { MoreButton } from '@/components/more-button'; import { RAGFlowAvatar } from '@/components/ragflow-avatar'; import { Card, CardContent } from '@/components/ui/card'; import { formatDate } from '@/utils/date'; @@ -11,9 +10,14 @@ type ApplicationCardProps = { update_time: number; }; onClick?(): void; + moreDropdown: React.ReactNode; }; -export function ApplicationCard({ app, onClick }: ApplicationCardProps) { +export function ApplicationCard({ + app, + onClick, + moreDropdown, +}: ApplicationCardProps) { return ( @@ -32,8 +36,7 @@ export function ApplicationCard({ app, onClick }: ApplicationCardProps) {

- - + {moreDropdown}
); diff --git a/web/src/pages/home/chat-list.tsx b/web/src/pages/home/chat-list.tsx index 616bec9e8..93e1c3de9 100644 --- a/web/src/pages/home/chat-list.tsx +++ b/web/src/pages/home/chat-list.tsx @@ -1,20 +1,53 @@ +import { MoreButton } from '@/components/more-button'; +import { RenameDialog } from '@/components/rename-dialog'; import { useNavigatePage } from '@/hooks/logic-hooks/navigate-hooks'; import { useFetchDialogList } from '@/hooks/use-chat-request'; +import { useTranslation } from 'react-i18next'; +import { ChatDropdown } from '../next-chats/chat-dropdown'; +import { useRenameChat } from '../next-chats/hooks/use-rename-chat'; import { ApplicationCard } from './application-card'; export function ChatList() { + const { t } = useTranslation(); const { data } = useFetchDialogList(); const { navigateToChat } = useNavigatePage(); - return data.dialogs.slice(0, 10).map((x) => ( - - )); + const { + initialChatName, + chatRenameVisible, + showChatRenameModal, + hideChatRenameModal, + onChatRenameOk, + chatRenameLoading, + } = useRenameChat(); + + return ( + <> + {data.dialogs.slice(0, 10).map((x) => ( + + + + } + > + ))} + {chatRenameVisible && ( + + )} + + ); }