From 42e2d5d1d22bea316fbefa00ba059bdb7e8e428e Mon Sep 17 00:00:00 2001 From: thaddmt <68032955+thaddmt@users.noreply.github.com> Date: Mon, 9 Sep 2024 17:14:03 -0700 Subject: [PATCH] fix(ai): remove unnecessary use of Buffer (#5774) * fix(ai): remove unnecessary use of Buffer * Create fluffy-fireants-doubt.md --- .changeset/fluffy-fireants-doubt.md | 5 +++++ .../AIConversation/views/Controls/FieldControl.tsx | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/fluffy-fireants-doubt.md diff --git a/.changeset/fluffy-fireants-doubt.md b/.changeset/fluffy-fireants-doubt.md new file mode 100644 index 00000000000..fe62e6ade2a --- /dev/null +++ b/.changeset/fluffy-fireants-doubt.md @@ -0,0 +1,5 @@ +--- +"@aws-amplify/ui-react-ai": patch +--- + +fix(ai): remove unnecessary use of Buffer diff --git a/packages/react-ai/src/components/AIConversation/views/Controls/FieldControl.tsx b/packages/react-ai/src/components/AIConversation/views/Controls/FieldControl.tsx index 4f3ccdd00e5..d44b1e0606c 100644 --- a/packages/react-ai/src/components/AIConversation/views/Controls/FieldControl.tsx +++ b/packages/react-ai/src/components/AIConversation/views/Controls/FieldControl.tsx @@ -168,7 +168,7 @@ export const FieldControl: FieldControl = () => { const fileContent: ConversationMessageContent = { image: { format: getImageTypeFromMimeType(file.type), - source: { bytes: Uint8Array.from(Buffer.from(buffer)) }, + source: { bytes: new Uint8Array(buffer) }, }, }; submittedContent.push(fileContent);