Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/Redis Backed Memory fix #1025

Merged
merged 1 commit into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,12 @@ class ConversationalAgent_Agents implements INode {
const callbacks = await additionalCallbacks(nodeData, options)

if (options && options.chatHistory) {
memory.chatHistory = mapChatHistory(options)
executor.memory = memory
const chatHistoryClassName = memory.chatHistory.constructor.name
// Only replace when its In-Memory
if (chatHistoryClassName && chatHistoryClassName === 'ChatMessageHistory') {
memory.chatHistory = mapChatHistory(options)
executor.memory = memory
}
}

const result = await executor.call({ input }, [...callbacks])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ class ConversationalRetrievalAgent_Agents implements INode {
if (executor.memory) {
;(executor.memory as any).memoryKey = 'chat_history'
;(executor.memory as any).outputKey = 'output'
;(executor.memory as any).chatHistory = mapChatHistory(options)
const chatHistoryClassName = (executor.memory as any).chatHistory.constructor.name
// Only replace when its In-Memory
if (chatHistoryClassName && chatHistoryClassName === 'ChatMessageHistory') {
;(executor.memory as any).chatHistory = mapChatHistory(options)
}
}

const loggerHandler = new ConsoleCallbackHandler(options.logger)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,12 @@ class OpenAIFunctionAgent_Agents implements INode {
const memory = nodeData.inputs?.memory as BaseChatMemory

if (options && options.chatHistory) {
memory.chatHistory = mapChatHistory(options)
executor.memory = memory
const chatHistoryClassName = memory.chatHistory.constructor.name
// Only replace when its In-Memory
if (chatHistoryClassName && chatHistoryClassName === 'ChatMessageHistory') {
memory.chatHistory = mapChatHistory(options)
executor.memory = memory
}
}

const loggerHandler = new ConsoleCallbackHandler(options.logger)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,12 @@ class ConversationChain_Chains implements INode {
const memory = nodeData.inputs?.memory as BufferMemory

if (options && options.chatHistory) {
memory.chatHistory = mapChatHistory(options)
chain.memory = memory
const chatHistoryClassName = memory.chatHistory.constructor.name
// Only replace when its In-Memory
if (chatHistoryClassName && chatHistoryClassName === 'ChatMessageHistory') {
memory.chatHistory = mapChatHistory(options)
chain.memory = memory
}
}

const loggerHandler = new ConsoleCallbackHandler(options.logger)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,11 @@ class ConversationalRetrievalQAChain_Chains implements INode {
const obj = { question: input }

if (options && options.chatHistory && chain.memory) {
;(chain.memory as any).chatHistory = mapChatHistory(options)
const chatHistoryClassName = (chain.memory as any).chatHistory.constructor.name
// Only replace when its In-Memory
if (chatHistoryClassName && chatHistoryClassName === 'ChatMessageHistory') {
;(chain.memory as any).chatHistory = mapChatHistory(options)
}
}

const loggerHandler = new ConsoleCallbackHandler(options.logger)
Expand Down