Skip to content

Commit

Permalink
Merge pull request #1500 from FlowiseAI/bugfix/Chatbot-Config-404
Browse files Browse the repository at this point in the history
Bugfix/GET chatbot config
  • Loading branch information
HenryHengZJ authored Jan 8, 2024
2 parents 33c7426 + bb77e3f commit ace50fa
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -362,15 +362,16 @@ 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)
} catch (e) {
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
Expand Down

0 comments on commit ace50fa

Please sign in to comment.