Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/add rendering html tags for share chatbot #3343

Merged
merged 1 commit into from
Oct 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions packages/ui/src/views/chatflows/ShareChatbot.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 ?? '')
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -312,6 +319,9 @@ const ShareChatbot = ({ isSessionMemory, isAgentCanvas }) => {
case 'showAgentMessages':
setShowAgentMessages(value)
break
case 'renderHTML':
setRenderHTML(value)
break
}
}

Expand Down Expand Up @@ -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 && (
<>
Expand Down
Loading