fix chatbot config
This commit is contained in:
parent
33c74261ec
commit
bb77e3f591
|
|
@ -362,7 +362,8 @@ export class App {
|
||||||
const chatflow = await this.AppDataSource.getRepository(ChatFlow).findOneBy({
|
const chatflow = await this.AppDataSource.getRepository(ChatFlow).findOneBy({
|
||||||
id: req.params.id
|
id: req.params.id
|
||||||
})
|
})
|
||||||
if (chatflow && chatflow.chatbotConfig) {
|
if (!chatflow) return res.status(404).send(`Chatflow ${req.params.id} not found`)
|
||||||
|
if (chatflow.chatbotConfig) {
|
||||||
try {
|
try {
|
||||||
const parsedConfig = JSON.parse(chatflow.chatbotConfig)
|
const parsedConfig = JSON.parse(chatflow.chatbotConfig)
|
||||||
return res.json(parsedConfig)
|
return res.json(parsedConfig)
|
||||||
|
|
@ -370,7 +371,7 @@ export class App {
|
||||||
return res.status(500).send(`Error parsing Chatbot Config for Chatflow ${req.params.id}`)
|
return res.status(500).send(`Error parsing Chatbot Config for Chatflow ${req.params.id}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return res.status(404).send(`Chatbot Config for Chatflow ${req.params.id} not found`)
|
return res.status(200).send('OK')
|
||||||
})
|
})
|
||||||
|
|
||||||
// Save chatflow
|
// Save chatflow
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue