Bugfix/Add showagent message when agentflow (#2749)

add showagent message when agentflow
This commit is contained in:
Henry Heng 2024-07-01 18:46:10 +01:00 committed by GitHub
parent 512df4197c
commit efc6e02828
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 11 additions and 6 deletions

View File

@ -76,13 +76,16 @@ const ChatbotFull = () => {
if (getSpecificChatflowFromPublicApi.data || getSpecificChatflowApi.data) {
const chatflowData = getSpecificChatflowFromPublicApi.data || getSpecificChatflowApi.data
setChatflow(chatflowData)
const chatflowType = chatflowData.type
if (chatflowData.chatbotConfig) {
let parsedConfig = {}
if (chatflowType === 'MULTIAGENT') {
parsedConfig.showAgentMessages = true
}
try {
const chatflowType = chatflowData.type
const parsedConfig = JSON.parse(chatflowData.chatbotConfig)
if (chatflowType === 'MULTIAGENT') {
parsedConfig.showAgentMessages = true
}
parsedConfig = { ...parsedConfig, ...JSON.parse(chatflowData.chatbotConfig) }
setChatbotTheme(parsedConfig)
if (parsedConfig.overrideConfig) {
// Generate new sessionId
@ -93,9 +96,11 @@ const ChatbotFull = () => {
}
} catch (e) {
console.error(e)
setChatbotTheme({})
setChatbotTheme(parsedConfig)
setChatbotOverrideConfig({})
}
} else if (chatflowType === 'MULTIAGENT') {
setChatbotTheme({ showAgentMessages: true })
}
}
}, [getSpecificChatflowFromPublicApi.data, getSpecificChatflowApi.data])