Bugfix/Share Chatbot Config (#3742)

fix chatbot config
This commit is contained in:
Henry Heng
2024-12-19 13:36:32 +00:00
committed by GitHub
parent 2df129f91b
commit d6b35465e5
2 changed files with 10 additions and 12 deletions
+4 -4
View File
@@ -88,12 +88,12 @@ const ChatbotFull = () => {
parsedConfig = { ...parsedConfig, ...JSON.parse(chatflowData.chatbotConfig) }
setChatbotTheme(parsedConfig)
if (parsedConfig.overrideConfig) {
// Generate new sessionId
if (parsedConfig.overrideConfig.generateNewSession) {
parsedConfig.overrideConfig.sessionId = Date.now().toString()
}
setChatbotOverrideConfig(parsedConfig.overrideConfig)
}
if (parsedConfig.generateNewSession) {
localStorage.removeItem(`${chatflowData.id}_EXTERNAL`)
}
} catch (e) {
console.error(e)
setChatbotTheme(parsedConfig)
@@ -111,8 +111,7 @@ const ShareChatbot = ({ isSessionMemory, isAgentCanvas }) => {
userMessage: {
showAvatar: false
},
textInput: {},
overrideConfig: {}
textInput: {}
}
if (title) obj.title = title
if (titleAvatarSrc) obj.titleAvatarSrc = titleAvatarSrc
@@ -137,7 +136,7 @@ const ShareChatbot = ({ isSessionMemory, isAgentCanvas }) => {
if (textInputPlaceholder) obj.textInput.placeholder = textInputPlaceholder
if (textInputSendButtonColor) obj.textInput.sendButtonColor = textInputSendButtonColor
if (isSessionMemory) obj.overrideConfig.generateNewSession = generateNewSession
if (isSessionMemory) obj.generateNewSession = generateNewSession
if (renderHTML) {
obj.renderHTML = true
@@ -145,8 +144,6 @@ const ShareChatbot = ({ isSessionMemory, isAgentCanvas }) => {
obj.renderHTML = false
}
if (chatbotConfig?.starterPrompts) obj.starterPrompts = chatbotConfig.starterPrompts
if (isAgentCanvas) {
// if showAgentMessages is undefined, default to true
if (showAgentMessages === undefined || showAgentMessages === null) {
@@ -156,9 +153,10 @@ const ShareChatbot = ({ isSessionMemory, isAgentCanvas }) => {
}
}
if (chatbotConfig?.fullFileUpload) obj.fullFileUpload = chatbotConfig?.fullFileUpload
return obj
return {
...chatbotConfig,
...obj
}
}
const onSave = async () => {