mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 13:00:56 +03:00
Feature/agentflow v2 (#4298)
* agent flow v2 * chat message background * conditon agent flow * add sticky note * update human input dynamic prompt * add HTTP node * add default tool icon * fix export duplicate agentflow v2 * add agentflow v2 marketplaces * refractor memoization, add iteration nodes * add agentflow v2 templates * add agentflow generator * add migration scripts for mysql, mariadb, posrgres and fix date filters for executions * update agentflow chat history config * fix get all flows error after deletion and rename * add previous nodes from parent node * update generator prompt * update run time state when using iteration nodes * prevent looping connection, prevent duplication of start node, add executeflow node, add nodes agentflow, chat history variable * update embed * convert form input to string * bump openai version * add react rewards * add prompt generator to prediction queue * add array schema to overrideconfig * UI touchup * update embedded chat version * fix node info dialog * update start node and loop default iteration * update UI fixes for agentflow v2 * fix async drop down * add export import to agentflowsv2, executions, fix UI bugs * add default empty object to flowlisttable * add ability to share trace link publicly, allow MCP tool use for Agent and Assistant * add runtime message length to variable, display conditions on UI * fix array validation * add ability to add knowledge from vector store and embeddings for agent * add agent tool require human input * add ephemeral memory to start node * update agent flow node to show vs and embeddings icons * feat: add import chat data functionality for AgentFlowV2 * feat: set chatMessage.executionId to null if not found in import JSON file or database * fix: MariaDB execution migration script to utf8mb4_unicode_520_ci --------- Co-authored-by: Ong Chung Yau <33013947+chungyau97@users.noreply.github.com> Co-authored-by: chungyau97 <chungyau97@gmail.com>
This commit is contained in:
@@ -712,7 +712,7 @@ export const mapChatMessageToBaseMessage = async (chatmessages: any[] = []): Pro
|
||||
for (const message of chatmessages) {
|
||||
if (message.role === 'apiMessage' || message.type === 'apiMessage') {
|
||||
chatHistory.push(new AIMessage(message.content || ''))
|
||||
} else if (message.role === 'userMessage' || message.role === 'userMessage') {
|
||||
} else if (message.role === 'userMessage' || message.type === 'userMessage') {
|
||||
// check for image/files uploads
|
||||
if (message.fileUploads) {
|
||||
// example: [{"type":"stored-file","name":"0_DiXc4ZklSTo3M8J4.jpg","mime":"image/jpeg"}]
|
||||
@@ -788,17 +788,23 @@ export const mapChatMessageToBaseMessage = async (chatmessages: any[] = []): Pro
|
||||
* @param {IMessage[]} chatHistory
|
||||
* @returns {string}
|
||||
*/
|
||||
export const convertChatHistoryToText = (chatHistory: IMessage[] = []): string => {
|
||||
export const convertChatHistoryToText = (chatHistory: IMessage[] | { content: string; role: string }[] = []): string => {
|
||||
return chatHistory
|
||||
.map((chatMessage) => {
|
||||
if (chatMessage.type === 'apiMessage') {
|
||||
return `Assistant: ${chatMessage.message}`
|
||||
} else if (chatMessage.type === 'userMessage') {
|
||||
return `Human: ${chatMessage.message}`
|
||||
if (!chatMessage) return ''
|
||||
const messageContent = 'message' in chatMessage ? chatMessage.message : chatMessage.content
|
||||
if (!messageContent || messageContent.trim() === '') return ''
|
||||
|
||||
const messageType = 'type' in chatMessage ? chatMessage.type : chatMessage.role
|
||||
if (messageType === 'apiMessage' || messageType === 'assistant') {
|
||||
return `Assistant: ${messageContent}`
|
||||
} else if (messageType === 'userMessage' || messageType === 'user') {
|
||||
return `Human: ${messageContent}`
|
||||
} else {
|
||||
return `${chatMessage.message}`
|
||||
return `${messageContent}`
|
||||
}
|
||||
})
|
||||
.filter((message) => message !== '') // Remove empty messages
|
||||
.join('\n')
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user