mirror of https://github.com/FlowiseAI/Flowise.git
Send uploads config if available, even when chatbot config is not available
parent
205670375d
commit
56b21862a3
|
|
@ -403,9 +403,11 @@ export class App {
|
|||
})
|
||||
if (!chatflow) return res.status(404).send(`Chatflow ${req.params.id} not found`)
|
||||
const uploadsConfig = await this.getUploadsConfig(req.params.id)
|
||||
if (chatflow.chatbotConfig) {
|
||||
// even if chatbotConfig is not set but uploads are enabled
|
||||
// send uploadsConfig to the chatbot
|
||||
if (chatflow.chatbotConfig || uploadsConfig) {
|
||||
try {
|
||||
const parsedConfig = JSON.parse(chatflow.chatbotConfig)
|
||||
const parsedConfig = chatflow.chatbotConfig ? JSON.parse(chatflow.chatbotConfig) : {}
|
||||
return res.json({ ...parsedConfig, uploads: uploadsConfig })
|
||||
} catch (e) {
|
||||
return res.status(500).send(`Error parsing Chatbot Config for Chatflow ${req.params.id}`)
|
||||
|
|
@ -447,14 +449,6 @@ export class App {
|
|||
const updateChatFlow = new ChatFlow()
|
||||
Object.assign(updateChatFlow, body)
|
||||
|
||||
// check if image uploads or speech have been enabled and update chatbotConfig
|
||||
const uploadsConfig = await this.getUploadsConfig(req.params.id)
|
||||
if (uploadsConfig) {
|
||||
// if there's existing chatbotConfig, merge uploadsConfig with it
|
||||
// if not just add uploadsConfig to chatbotConfig
|
||||
Object.assign(updateChatFlow, { chatbotConfig: { ...((chatflow.chatbotConfig ?? {}) as object), ...uploadsConfig } })
|
||||
}
|
||||
|
||||
updateChatFlow.id = chatflow.id
|
||||
createRateLimiter(updateChatFlow)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue