mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 07:00:49 +03:00
@@ -114,11 +114,14 @@ const updateChatflow = async (req: Request, res: Response, next: NextFunction) =
|
||||
if (!chatflow) {
|
||||
return res.status(404).send(`Chatflow ${req.params.id} not found`)
|
||||
}
|
||||
|
||||
const body = req.body
|
||||
const updateChatFlow = new ChatFlow()
|
||||
Object.assign(updateChatFlow, body)
|
||||
|
||||
updateChatFlow.id = chatflow.id
|
||||
createRateLimiter(updateChatFlow)
|
||||
|
||||
const apiResponse = await chatflowsService.updateChatflow(chatflow, updateChatFlow)
|
||||
return res.json(apiResponse)
|
||||
} catch (error) {
|
||||
|
||||
@@ -217,11 +217,12 @@ const saveChatflow = async (newChatFlow: ChatFlow): Promise<any> => {
|
||||
const updateChatflow = async (chatflow: ChatFlow, updateChatFlow: ChatFlow): Promise<any> => {
|
||||
try {
|
||||
const appServer = getRunningExpressApp()
|
||||
if (containsBase64File(updateChatFlow)) {
|
||||
if (updateChatFlow.flowData && containsBase64File(updateChatFlow)) {
|
||||
updateChatFlow.flowData = updateFlowDataWithFilePaths(chatflow.id, updateChatFlow.flowData)
|
||||
}
|
||||
const newDbChatflow = await appServer.AppDataSource.getRepository(ChatFlow).merge(chatflow, updateChatFlow)
|
||||
const newDbChatflow = appServer.AppDataSource.getRepository(ChatFlow).merge(chatflow, updateChatFlow)
|
||||
const dbResponse = await appServer.AppDataSource.getRepository(ChatFlow).save(newDbChatflow)
|
||||
|
||||
// chatFlowPool is initialized only when a flow is opened
|
||||
// if the user attempts to rename/update category without opening any flow, chatFlowPool will be undefined
|
||||
if (appServer.chatflowPool) {
|
||||
|
||||
Reference in New Issue
Block a user