diff --git a/.changeset/great-kids-worry.md b/.changeset/great-kids-worry.md new file mode 100644 index 000000000..5f8b82048 --- /dev/null +++ b/.changeset/great-kids-worry.md @@ -0,0 +1,5 @@ +--- +"assistant-ui": patch +--- + +feat: ignore edits with text part unchanged diff --git a/packages/react/src/context/providers/MessageProvider.tsx b/packages/react/src/context/providers/MessageProvider.tsx index 50faf8681..cdee3688d 100644 --- a/packages/react/src/context/providers/MessageProvider.tsx +++ b/packages/react/src/context/providers/MessageProvider.tsx @@ -89,6 +89,9 @@ const useMessageContext = (messageIndex: number) => { "Tried to edit a non-user message. Editing is only supported for user messages. This is likely an internal bug in assistant-ui.", ); + const previousText = getThreadMessageText(message); + if (previousText === text) return; + const nonTextParts = message.content.filter( (part): part is CoreUserContentPart => part.type !== "text" && part.type !== "ui",