From 9a393be01268fdeef1284c7a464f767df40f2d14 Mon Sep 17 00:00:00 2001 From: Danny Avila Date: Thu, 12 Sep 2024 06:06:22 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=AA=A8=20fix:=20Formatting=20Edge=20Case?= =?UTF-8?q?=20Handling=20for=20Bedrock=20Messages=20(#4016)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * refactor: Remove console.log statement in SelectDropDown component * fix(bedrock): edge case - message.content as string creating message formatting issue --- api/app/clients/prompts/formatMessages.js | 3 +++ client/src/components/ui/SelectDropDown.tsx | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/api/app/clients/prompts/formatMessages.js b/api/app/clients/prompts/formatMessages.js index a5ed05c645..1ea44f9d29 100644 --- a/api/app/clients/prompts/formatMessages.js +++ b/api/app/clients/prompts/formatMessages.js @@ -142,6 +142,9 @@ const formatAgentMessages = (payload) => { const messages = []; for (const message of payload) { + if (typeof message.content === 'string') { + message.content = [{ type: ContentTypes.TEXT, [ContentTypes.TEXT]: message.content }]; + } if (message.role !== 'assistant') { messages.push(formatMessage({ message, langChain: true })); continue; diff --git a/client/src/components/ui/SelectDropDown.tsx b/client/src/components/ui/SelectDropDown.tsx index 550a6bf456..26ed808b28 100644 --- a/client/src/components/ui/SelectDropDown.tsx +++ b/client/src/components/ui/SelectDropDown.tsx @@ -102,7 +102,6 @@ function SelectDropDown({ const hasSearchRender = searchRender != null; const options = hasSearchRender ? filteredValues : availableValues; - console.log({ hasSearchRender, options }); const renderIcon = showOptionIcon && value != null && (value as OptionWithIcon).icon != null; return (