mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 17:01:00 +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[] = [
|
const messages: BaseMessagePromptTemplateLike[] = [
|
||||||
SystemMessagePromptTemplate.fromTemplate(prompt ? prompt : systemMessage),
|
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
|
// OpenAI works better when separate images into standalone human messages
|
||||||
if (model instanceof ChatOpenAI && humanImageMessages.length) {
|
if (model instanceof ChatOpenAI && humanImageMessages.length) {
|
||||||
messages.push(HumanMessagePromptTemplate.fromTemplate(`{${inputKey}}`))
|
|
||||||
messages.push(new HumanMessage({ content: [...humanImageMessages] }))
|
messages.push(new HumanMessage({ content: [...humanImageMessages] }))
|
||||||
} else if (humanImageMessages.length) {
|
} else if (humanImageMessages.length) {
|
||||||
|
messages.pop()
|
||||||
messages.push(HumanMessagePromptTemplate.fromTemplate([`{${inputKey}}`, ...humanImageMessages]))
|
messages.push(HumanMessagePromptTemplate.fromTemplate([`{${inputKey}}`, ...humanImageMessages]))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user