From 56421e03fe0ddadade1cd80cf1eabe3b502c8447 Mon Sep 17 00:00:00 2001 From: Henry Date: Fri, 11 Oct 2024 23:14:45 +0100 Subject: [PATCH] add rendering html tags for share chatbot --- .../ui/src/views/chatflows/ShareChatbot.jsx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/packages/ui/src/views/chatflows/ShareChatbot.jsx b/packages/ui/src/views/chatflows/ShareChatbot.jsx index 9c5de4c36ae..7b09b0ff396 100644 --- a/packages/ui/src/views/chatflows/ShareChatbot.jsx +++ b/packages/ui/src/views/chatflows/ShareChatbot.jsx @@ -56,6 +56,7 @@ const ShareChatbot = ({ isSessionMemory, isAgentCanvas }) => { const [isPublicChatflow, setChatflowIsPublic] = useState(chatflow.isPublic ?? false) const [generateNewSession, setGenerateNewSession] = useState(chatbotConfig?.generateNewSession ?? false) + const [renderHTML, setRenderHTML] = useState(chatbotConfig?.renderHTML ?? false) const [title, setTitle] = useState(chatbotConfig?.title ?? '') const [titleAvatarSrc, setTitleAvatarSrc] = useState(chatbotConfig?.titleAvatarSrc ?? '') @@ -138,6 +139,12 @@ const ShareChatbot = ({ isSessionMemory, isAgentCanvas }) => { if (isSessionMemory) obj.overrideConfig.generateNewSession = generateNewSession + if (renderHTML) { + obj.overrideConfig.renderHTML = true + } else { + obj.overrideConfig.renderHTML = false + } + if (chatbotConfig?.starterPrompts) obj.starterPrompts = chatbotConfig.starterPrompts if (isAgentCanvas) { @@ -312,6 +319,9 @@ const ShareChatbot = ({ isSessionMemory, isAgentCanvas }) => { case 'showAgentMessages': setShowAgentMessages(value) break + case 'renderHTML': + setRenderHTML(value) + break } } @@ -480,6 +490,13 @@ const ShareChatbot = ({ isSessionMemory, isAgentCanvas }) => { {textField(textInputPlaceholder, 'textInputPlaceholder', 'TextInput Placeholder', 'string', `Type question..`)} {colorField(textInputSendButtonColor, 'textInputSendButtonColor', 'TextIntput Send Button Color')} + <> + + Render HTML + + {booleanField(renderHTML, 'renderHTML', 'Render HTML on the chat')} + + {/*Session Memory Input*/} {isSessionMemory && ( <>