聊天内存管理器节点#
¥Chat Memory Manager node
聊天内存管理器节点管理工作流中的聊天消息 memories。使用此节点可以在内存中的 矢量商店 中加载、插入和删除聊天消息。
¥The Chat Memory Manager node manages chat message memories within your workflows. Use this node to load, insert, and delete chat messages in an in-memory vector store.
This node is useful when you:
- Can't add a memory node directly.
- Need to do more complex memory management, beyond what the memory nodes offer. For example, you can add this node to check the memory size of the Agent node's response, and reduce it if needed.
- Want to inject messages to the AI that look like user messages, to give the AI more context.
本页面列出了聊天内存管理器节点支持的操作列表以及更多资源的链接。
¥On this page, you'll find a list of operations that the Chat Memory Manager node supports, along with links to more resources.
Parameter resolution in sub-nodes
Sub-nodes behave differently to other nodes when processing multiple items using an expression.
Most nodes, including root nodes, take any number of items as input, process these items, and output the results. You can use expressions to refer to input items, and the node resolves the expression for each item in turn. For example, given an input of five name values, the expression {{ $json.name }} resolves to each name in turn.
In sub-nodes, the expression always resolves to the first item. For example, given an input of five name values, the expression {{ $json.name }} always resolves to the first name.
节点参数#
¥Node parameters
- 操作模式:选择“获取多条消息”、“插入消息”或“删除消息”操作。
¥Operation Mode: Choose between Get Many Messages, Insert Messages, and Delete Messages operations.
- 插入模式:在“插入邮件”模式下可用。选择以下选项:
¥Insert Mode: Available in Insert Messages mode. Choose from:
-
插入消息:在现有消息旁边插入新消息。
¥Insert Messages: Insert messages alongside existing messages.
-
覆盖所有消息:替换当前内存。
¥Override All Messages: Replace current memory.
-
删除模式:在“删除消息”模式下可用。选择以下选项:
¥Delete Mode: available in Delete Messages mode. Choose from:
-
最新 N:删除最后 N 条消息。
¥Last N: Delete the last N messages.
-
所有消息:从内存中删除消息。
¥All Messages: Delete messages from memory.
-
聊天消息:可在“插入消息”模式下使用。定义要插入内存的聊天消息,包括:
¥Chat Messages: available in Insert Messages mode. Define the chat messages to insert into the memory, including:
-
输入名称或 ID:设置消息类型。选择以下选项之一:
¥Type Name or ID: Set the message type. Select one of:
- AI:用于接收来自 AI 的消息。
¥AI: Use this for messages from the AI.
- 系统:添加包含 AI 指令的消息。
¥System: Add a message containing instructions for the AI.
- 用户:用于接收来自用户的消息。在其他 AI 工具和指南中,这种消息类型有时被称为 'human' 消息。
¥User: Use this for messages from the user. This message type is sometimes called the 'human' message in other AI tools and guides.
-
消息:输入消息内容。
¥Message: Enter the message contents.
-
隐藏聊天消息:选择 n8n 是否在聊天界面向用户显示消息(关闭)或不显示(开启)。
¥Hide Message in Chat: Select whether n8n should display the message to the user in the chat UI (turned off) or not (turned on).
-
消息计数:在“删除邮件”模式下选择“最后 N 条”时可用。输入要删除的最新消息数量。
¥Messages Count: Available in Delete Messages mode when you select Last N. Enter the number of latest messages to delete.
- 简化输出:在“获取多条邮件”模式下可用。启用此功能可简化输出,仅包含发送者(AI、用户或系统)和文本。
¥Simplify Output: Available in Get Many Messages mode. Turn on to simplify the output to include only the sender (AI, user, or system) and the text.
模板和示例#
¥Templates and examples
相关资源#
¥Related resources
有关服务的更多信息,请参阅 LangChain 的内存文档。
¥Refer to LangChain's Memory documentation for more information about the service.
View n8n's Advanced AI documentation.