mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 23:01:09 +03:00
@@ -118,14 +118,16 @@ class BufferWindowMemoryExtended extends FlowiseWindowMemory implements MemoryMe
|
||||
sessionId: id,
|
||||
chatflowid: this.chatflowid
|
||||
},
|
||||
take: this.k + 1,
|
||||
order: {
|
||||
createdDate: 'DESC' // we get the latest top K
|
||||
createdDate: 'ASC'
|
||||
}
|
||||
})
|
||||
|
||||
// reverse the order of human and ai messages
|
||||
if (chatMessage.length) chatMessage.reverse()
|
||||
if (this.k <= 0) {
|
||||
chatMessage = []
|
||||
} else {
|
||||
chatMessage = chatMessage.slice(-this.k * 2)
|
||||
}
|
||||
|
||||
if (prependMessages?.length) {
|
||||
chatMessage.unshift(...prependMessages)
|
||||
|
||||
Reference in New Issue
Block a user