mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 21:00:58 +03:00
Send uploads config if available, even when chatbot config is not available
This commit is contained in:
@@ -403,9 +403,11 @@ export class App {
|
|||||||
})
|
})
|
||||||
if (!chatflow) return res.status(404).send(`Chatflow ${req.params.id} not found`)
|
if (!chatflow) return res.status(404).send(`Chatflow ${req.params.id} not found`)
|
||||||
const uploadsConfig = await this.getUploadsConfig(req.params.id)
|
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 {
|
try {
|
||||||
const parsedConfig = JSON.parse(chatflow.chatbotConfig)
|
const parsedConfig = chatflow.chatbotConfig ? JSON.parse(chatflow.chatbotConfig) : {}
|
||||||
return res.json({ ...parsedConfig, uploads: uploadsConfig })
|
return res.json({ ...parsedConfig, uploads: uploadsConfig })
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
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}`)
|
||||||
@@ -447,14 +449,6 @@ export class App {
|
|||||||
const updateChatFlow = new ChatFlow()
|
const updateChatFlow = new ChatFlow()
|
||||||
Object.assign(updateChatFlow, body)
|
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
|
updateChatFlow.id = chatflow.id
|
||||||
createRateLimiter(updateChatFlow)
|
createRateLimiter(updateChatFlow)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user