From 113a79dfb73500d4a3859c0c17058cd3ebcecbba Mon Sep 17 00:00:00 2001
From: Pleasurecruise <3196812536@qq.com>
Date: Tue, 3 Jun 2025 13:50:00 +0800
Subject: [PATCH] fix: Improve the switching logic in multi-tab state
---
.../src/pages/home/Tabs/components/AssistantItem.tsx | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/src/renderer/src/pages/home/Tabs/components/AssistantItem.tsx b/src/renderer/src/pages/home/Tabs/components/AssistantItem.tsx
index 6e18036245..3d7b920f89 100644
--- a/src/renderer/src/pages/home/Tabs/components/AssistantItem.tsx
+++ b/src/renderer/src/pages/home/Tabs/components/AssistantItem.tsx
@@ -1,4 +1,5 @@
import {
+ CheckOutlined,
DeleteOutlined,
EditOutlined,
MinusCircleOutlined,
@@ -185,10 +186,9 @@ const handleTagOperation = (
updateAssistants: (assistants: Assistant[]) => void
) => {
if (assistant.tags?.includes(tag)) {
- updateAssistants(assistants.map((a) => (a.id === assistant.id ? { ...a, tags: [] } : a)))
- } else {
- updateAssistants(assistants.map((a) => (a.id === assistant.id ? { ...a, tags: [tag] } : a)))
+ return
}
+ updateAssistants(assistants.map((a) => (a.id === assistant.id ? { ...a, tags: [tag] } : a)))
}
// 提取创建菜单项的函数
@@ -202,8 +202,7 @@ const createTagMenuItems = (
const items: MenuProps['items'] = [
...allTags.map((tag) => ({
label: tag,
- icon: assistant.tags?.includes(tag) ? : ,
- danger: assistant.tags?.includes(tag),
+ icon: assistant.tags?.includes(tag) ? : ,
key: `all-tag-${tag}`,
onClick: () => handleTagOperation(tag, assistant, assistants, updateAssistants)
}))