mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-22 09:01:09 +03:00
Feature/Add prepend messages to memory (#2410)
add prepend messages to memory
This commit is contained in:
@@ -71,6 +71,7 @@ class ContextChatEngine_LlamaIndex implements INode {
|
||||
const systemMessagePrompt = nodeData.inputs?.systemMessagePrompt as string
|
||||
const memory = nodeData.inputs?.memory as FlowiseMemory
|
||||
const returnSourceDocuments = nodeData.inputs?.returnSourceDocuments as boolean
|
||||
const prependMessages = options?.prependMessages
|
||||
|
||||
const chatHistory = [] as ChatMessage[]
|
||||
|
||||
@@ -83,7 +84,7 @@ class ContextChatEngine_LlamaIndex implements INode {
|
||||
|
||||
const chatEngine = new ContextChatEngine({ chatModel: model, retriever: vectorStoreRetriever })
|
||||
|
||||
const msgs = (await memory.getChatMessages(this.sessionId, false)) as IMessage[]
|
||||
const msgs = (await memory.getChatMessages(this.sessionId, false, prependMessages)) as IMessage[]
|
||||
for (const message of msgs) {
|
||||
if (message.type === 'apiMessage') {
|
||||
chatHistory.push({
|
||||
|
||||
Reference in New Issue
Block a user