From 2bb4bf877ba9fdafcb6f1bf48c219d9c4245098b Mon Sep 17 00:00:00 2001 From: Sun Tao <2605127667@qq.com> Date: Fri, 7 Nov 2025 17:29:26 +0800 Subject: [PATCH] Update TaskCard.tsx --- src/components/ChatBox/TaskCard.tsx | 32 ++++++++++------------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/src/components/ChatBox/TaskCard.tsx b/src/components/ChatBox/TaskCard.tsx index 6ebdb0952..03a85f8a1 100644 --- a/src/components/ChatBox/TaskCard.tsx +++ b/src/components/ChatBox/TaskCard.tsx @@ -332,27 +332,17 @@ export function TaskCard({ onClick={() => { if (task.agent) { // Switch to the chatStore that owns this task card (for multi-turn conversations) - if (chatId) { - const activeProjectId = projectStore.activeProjectId; - const activeChatStore = projectStore.getActiveChatStore(); - const project = activeProjectId - ? projectStore.projects?.[activeProjectId] - : undefined; - - if (activeChatStore && project?.chatStores) { - const currentChatId = Object.keys(project.chatStores).find( - (id) => project.chatStores[id] === activeChatStore - ) ?? null; - - // Only switch if this is a different chat - if (activeProjectId && currentChatId !== chatId) { - projectStore.setActiveChatStore(activeProjectId, chatId); - } - } else if (activeProjectId) { - // If no active chat store, set based on this task - projectStore.setActiveChatStore(activeProjectId, chatId); - } - } + if (chatId && projectStore.activeProjectId) { + const activeChatStore = projectStore.getActiveChatStore(); + const currentChatId = activeChatStore ? Object.keys(projectStore.projects[projectStore.activeProjectId].chatStores).find( + id => projectStore.projects[projectStore.activeProjectId].chatStores[id] === activeChatStore + ) : null; + + // Only switch if this is a different chat + if (currentChatId !== chatId) { + projectStore.setActiveChatStore(projectStore.activeProjectId, chatId); + } + } // Set the active workspace and agent chatStore.setActiveWorkSpace(