mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-29 07:01:04 +03:00
Feature/Add prepend messages to memory (#2410)
add prepend messages to memory
This commit is contained in:
@@ -145,6 +145,9 @@ export const utilBuildChatflow = async (req: Request, socketIO?: Server, isInter
|
||||
const memoryType = memoryNode?.data.label
|
||||
let sessionId = getMemorySessionId(memoryNode, incomingInput, chatId, isInternal)
|
||||
|
||||
// Get prepend messages
|
||||
const prependMessages = incomingInput.history
|
||||
|
||||
/* Reuse the flow without having to rebuild (to avoid duplicated upsert, recomputation, reinitialization of memory) when all these conditions met:
|
||||
* - Node Data already exists in pool
|
||||
* - Still in sync (i.e the flow has not been modified since)
|
||||
@@ -226,7 +229,8 @@ export const utilBuildChatflow = async (req: Request, socketIO?: Server, isInter
|
||||
appServer.nodesPool.componentNodes,
|
||||
appServer.AppDataSource,
|
||||
databaseEntities,
|
||||
logger
|
||||
logger,
|
||||
prependMessages
|
||||
)
|
||||
}
|
||||
|
||||
@@ -301,7 +305,8 @@ export const utilBuildChatflow = async (req: Request, socketIO?: Server, isInter
|
||||
analytic: chatflow.analytic,
|
||||
uploads: incomingInput.uploads,
|
||||
socketIO,
|
||||
socketIOClientId: incomingInput.socketIOClientId
|
||||
socketIOClientId: incomingInput.socketIOClientId,
|
||||
prependMessages
|
||||
})
|
||||
: await nodeInstance.run(nodeToExecuteData, incomingInput.question, {
|
||||
chatId,
|
||||
@@ -310,7 +315,8 @@ export const utilBuildChatflow = async (req: Request, socketIO?: Server, isInter
|
||||
appDataSource: appServer.AppDataSource,
|
||||
databaseEntities,
|
||||
analytic: chatflow.analytic,
|
||||
uploads: incomingInput.uploads
|
||||
uploads: incomingInput.uploads,
|
||||
prependMessages
|
||||
})
|
||||
result = typeof result === 'string' ? { text: result } : result
|
||||
|
||||
|
||||
Reference in New Issue
Block a user