mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 19:00:59 +03:00
add Zep VS and update Zep Memory
This commit is contained in:
@@ -120,7 +120,8 @@ class ZepMemory_Memory implements INode {
|
||||
zep.loadMemoryVariables = async (values) => {
|
||||
let data = await tmpFunc.bind(zep, values)()
|
||||
if (autoSummary && zep.returnMessages && data[zep.memoryKey] && data[zep.memoryKey].length) {
|
||||
const memory = await zep.zepClient.getMemory(zep.sessionId, parseInt(k, 10) ?? 10)
|
||||
const zepClient = await zep.zepClientPromise
|
||||
const memory = await zepClient.memory.getMemory(zep.sessionId, parseInt(k, 10) ?? 10)
|
||||
if (memory?.summary) {
|
||||
let summary = autoSummaryTemplate.replace(/{summary}/g, memory.summary.content)
|
||||
// eslint-disable-next-line no-console
|
||||
@@ -190,23 +191,6 @@ class ZepMemoryExtended extends ZepMemory {
|
||||
super(fields)
|
||||
this.isSessionIdUsingChatMessageId = fields.isSessionIdUsingChatMessageId
|
||||
}
|
||||
|
||||
async clear(): Promise<void> {
|
||||
// Only clear when sessionId is using chatId
|
||||
// If sessionId is specified, clearing and inserting again will error because the sessionId has been soft deleted
|
||||
// If using chatId, it will not be a problem because the sessionId will always be the new chatId
|
||||
if (this.isSessionIdUsingChatMessageId) {
|
||||
try {
|
||||
await this.zepClient.deleteMemory(this.sessionId)
|
||||
} catch (error) {
|
||||
console.error('Error deleting session: ', error)
|
||||
}
|
||||
|
||||
// Clear the superclass's chat history
|
||||
await super.clear()
|
||||
}
|
||||
await this.chatHistory.clear()
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { nodeClass: ZepMemory_Memory }
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 24 KiB |
Reference in New Issue
Block a user