Skip to content

Commit d6b3546

Browse files
authored
Bugfix/Share Chatbot Config (#3742)
fix chatbot config
1 parent 2df129f commit d6b3546

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

packages/ui/src/views/chatbot/index.jsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,12 @@ const ChatbotFull = () => {
8888
parsedConfig = { ...parsedConfig, ...JSON.parse(chatflowData.chatbotConfig) }
8989
setChatbotTheme(parsedConfig)
9090
if (parsedConfig.overrideConfig) {
91-
// Generate new sessionId
92-
if (parsedConfig.overrideConfig.generateNewSession) {
93-
parsedConfig.overrideConfig.sessionId = Date.now().toString()
94-
}
9591
setChatbotOverrideConfig(parsedConfig.overrideConfig)
9692
}
93+
94+
if (parsedConfig.generateNewSession) {
95+
localStorage.removeItem(`${chatflowData.id}_EXTERNAL`)
96+
}
9797
} catch (e) {
9898
console.error(e)
9999
setChatbotTheme(parsedConfig)

packages/ui/src/views/chatflows/ShareChatbot.jsx

+6-8
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,7 @@ const ShareChatbot = ({ isSessionMemory, isAgentCanvas }) => {
111111
userMessage: {
112112
showAvatar: false
113113
},
114-
textInput: {},
115-
overrideConfig: {}
114+
textInput: {}
116115
}
117116
if (title) obj.title = title
118117
if (titleAvatarSrc) obj.titleAvatarSrc = titleAvatarSrc
@@ -137,16 +136,14 @@ const ShareChatbot = ({ isSessionMemory, isAgentCanvas }) => {
137136
if (textInputPlaceholder) obj.textInput.placeholder = textInputPlaceholder
138137
if (textInputSendButtonColor) obj.textInput.sendButtonColor = textInputSendButtonColor
139138

140-
if (isSessionMemory) obj.overrideConfig.generateNewSession = generateNewSession
139+
if (isSessionMemory) obj.generateNewSession = generateNewSession
141140

142141
if (renderHTML) {
143142
obj.renderHTML = true
144143
} else {
145144
obj.renderHTML = false
146145
}
147146

148-
if (chatbotConfig?.starterPrompts) obj.starterPrompts = chatbotConfig.starterPrompts
149-
150147
if (isAgentCanvas) {
151148
// if showAgentMessages is undefined, default to true
152149
if (showAgentMessages === undefined || showAgentMessages === null) {
@@ -156,9 +153,10 @@ const ShareChatbot = ({ isSessionMemory, isAgentCanvas }) => {
156153
}
157154
}
158155

159-
if (chatbotConfig?.fullFileUpload) obj.fullFileUpload = chatbotConfig?.fullFileUpload
160-
161-
return obj
156+
return {
157+
...chatbotConfig,
158+
...obj
159+
}
162160
}
163161

164162
const onSave = async () => {

0 commit comments

Comments
 (0)