mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-22 09:01:09 +03:00
+8
-2
@@ -10,9 +10,10 @@ import {
|
||||
} from '../../../src/Interface'
|
||||
import { getBaseClasses, mapChatMessageToBaseMessage } from '../../../src/utils'
|
||||
import { BaseLanguageModel } from '@langchain/core/language_models/base'
|
||||
import { BaseMessage, SystemMessage } from '@langchain/core/messages'
|
||||
import { BaseMessage, HumanMessage, SystemMessage } from '@langchain/core/messages'
|
||||
import { ConversationSummaryMemory, ConversationSummaryMemoryInput } from 'langchain/memory'
|
||||
import { DataSource } from 'typeorm'
|
||||
import { ChatAnthropic } from '../../chatmodels/ChatAnthropic/FlowiseChatAnthropic'
|
||||
|
||||
class ConversationSummaryMemory_Memory implements INode {
|
||||
label: string
|
||||
@@ -135,7 +136,12 @@ class ConversationSummaryMemoryExtended extends FlowiseSummaryMemory implements
|
||||
}
|
||||
|
||||
if (returnBaseMessages) {
|
||||
return [new SystemMessage(this.buffer)]
|
||||
// Anthropic doesn't support multiple system messages
|
||||
if (this.llm instanceof ChatAnthropic) {
|
||||
return [new HumanMessage(`Below is the summarized conversation:\n\n${this.buffer}`)]
|
||||
} else {
|
||||
return [new SystemMessage(this.buffer)]
|
||||
}
|
||||
}
|
||||
|
||||
if (this.buffer) {
|
||||
|
||||
Reference in New Issue
Block a user