mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 15:00:57 +03:00
add vector to prompt
This commit is contained in:
@@ -520,3 +520,22 @@ export const mapChatHistory = (options: ICommonObject): ChatMessageHistory => {
|
||||
}
|
||||
return new ChatMessageHistory(chatHistory)
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert incoming chat history to string
|
||||
* @param {IMessage[]} chatHistory
|
||||
* @returns {string}
|
||||
*/
|
||||
export const convertChatHistoryToText = (chatHistory: IMessage[]): string => {
|
||||
return chatHistory
|
||||
.map((chatMessage) => {
|
||||
if (chatMessage.type === 'apiMessage') {
|
||||
return `Assistant: ${chatMessage.message}`
|
||||
} else if (chatMessage.type === 'userMessage') {
|
||||
return `Human: ${chatMessage.message}`
|
||||
} else {
|
||||
return `${chatMessage.message}`
|
||||
}
|
||||
})
|
||||
.join('\n')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user