mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-22 09:01:09 +03:00
Merge pull request #1929 from FlowiseAI/bugfix/Conversation-Chain-Human-Message
Bugfix/Conversation Chain Human Message
This commit is contained in:
@@ -199,14 +199,15 @@ const prepareChatPrompt = (nodeData: INodeData, humanImageMessages: MessageConte
|
||||
|
||||
const messages: BaseMessagePromptTemplateLike[] = [
|
||||
SystemMessagePromptTemplate.fromTemplate(prompt ? prompt : systemMessage),
|
||||
new MessagesPlaceholder(memory.memoryKey ?? 'chat_history')
|
||||
new MessagesPlaceholder(memory.memoryKey ?? 'chat_history'),
|
||||
HumanMessagePromptTemplate.fromTemplate(`{${inputKey}}`)
|
||||
]
|
||||
|
||||
// OpenAI works better when separate images into standalone human messages
|
||||
if (model instanceof ChatOpenAI && humanImageMessages.length) {
|
||||
messages.push(HumanMessagePromptTemplate.fromTemplate(`{${inputKey}}`))
|
||||
messages.push(new HumanMessage({ content: [...humanImageMessages] }))
|
||||
} else if (humanImageMessages.length) {
|
||||
messages.pop()
|
||||
messages.push(HumanMessagePromptTemplate.fromTemplate([`{${inputKey}}`, ...humanImageMessages]))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user