From aea6f819377e5867a32710f3bdf1ca02131c22c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=B7=E5=B8=83=E5=8A=B3=E5=A4=96=20=C2=B7=20=E8=B4=BE?= =?UTF-8?q?=E8=B4=B5?= <472285740@qq.com> Date: Thu, 14 Aug 2025 10:15:48 +0800 Subject: [PATCH] fix(core): remove attachment chip failed (#13468) > CLOSE PD-2697 ## Summary by CodeRabbit * **Bug Fixes** * Removing an attachment chip now also removes duplicate attachments with the same source, preventing duplicate attachments in the AI chat chip list. * Removing a selected context chip now also removes duplicate selected contexts with the same identifier, preventing duplicate context chips. * Attachments from different sources and chips of other types (document, file, tag, collection) remain unaffected. --- .../core/src/blocksuite/ai/components/ai-chat-chips/utils.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/frontend/core/src/blocksuite/ai/components/ai-chat-chips/utils.ts b/packages/frontend/core/src/blocksuite/ai/components/ai-chat-chips/utils.ts index fd655b314..f525c80bb 100644 --- a/packages/frontend/core/src/blocksuite/ai/components/ai-chat-chips/utils.ts +++ b/packages/frontend/core/src/blocksuite/ai/components/ai-chat-chips/utils.ts @@ -108,7 +108,10 @@ export function omitChip(chips: ChatChip[], chip: ChatChip) { return !isCollectionChip(item) || item.collectionId !== chip.collectionId; } if (isSelectedContextChip(chip)) { - return !isSelectedContextChip(chip); + return !isSelectedContextChip(item) || item.uuid !== chip.uuid; + } + if (isAttachmentChip(chip)) { + return !isAttachmentChip(item) || item.sourceId !== chip.sourceId; } return true; });