fix(core): remove attachment chip failed (#13468)

> CLOSE PD-2697

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## 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.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
德布劳外 · 贾贵
2025-08-14 10:15:48 +08:00
committed by GitHub
parent 66c2bf3151
commit aea6f81937

View File

@@ -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;
});