Feature/add rendering html tags for share chatbot (#3343)

add rendering html tags for share chatbot
This commit is contained in:
Henry Heng 2024-10-21 11:37:13 +01:00 committed by GitHub
parent 4a9ffe7b99
commit a0d93f910f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 17 additions and 0 deletions

View File

@ -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')}
<>
<Typography variant='h4' sx={{ mb: 1, mt: 2 }}>
Render HTML
</Typography>
{booleanField(renderHTML, 'renderHTML', 'Render HTML on the chat')}
</>
{/*Session Memory Input*/}
{isSessionMemory && (
<>