Merge pull request #1500 from FlowiseAI/bugfix/Chatbot-Config-404

Bugfix/GET chatbot config
This commit is contained in:
Henry Heng 2024-01-08 18:08:46 +00:00 committed by GitHub
commit ace50faa7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -362,7 +362,8 @@ export class App {
const chatflow = await this.AppDataSource.getRepository(ChatFlow).findOneBy({
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 {
const parsedConfig = JSON.parse(chatflow.chatbotConfig)
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(404).send(`Chatbot Config for Chatflow ${req.params.id} not found`)
return res.status(200).send('OK')
})
// Save chatflow