聊天触发器节点常见问题#
¥Chat Trigger node common issues
以下是 聊天触发器节点 的一些常见错误和问题,以及解决或故障排除步骤。
¥Here are some common errors and issues with the Chat Trigger node and steps to resolve or troubleshoot them.
将数据从网站传递到嵌入式聊天触发节点#
¥Pass data from a website to an embedded Chat Trigger node
当 embedding 为网站中的聊天触发器节点时,你可能需要向聊天触发器传递额外信息。例如,传递存储在网站 cookie 中的用户 ID。
¥When embedding the Chat Trigger node in a website, you might want to pass extra information to the Chat Trigger. For example, passing a user ID stored in a site cookie.
为此,请在你传递给嵌入式聊天窗口中的 createChat 函数的 JSON 对象中使用 metadata 字段:
¥To do this, use the metadata field in the JSON object you pass to the createChat function in your embedded chat window:
1 2 3 4 5 6 | |
metadata 字段可以包含任意数据,这些数据将与其他输出数据一起显示在聊天触发器输出中。从这里,你可以像往常一样使用 n8n 的 数据处理功能 查询和处理来自下游节点的数据。
¥The metadata field can contain arbitrary data that will appear in the Chat Trigger output alongside other output data. From there, you can query and process the data from downstream nodes as usual using n8n's data processing features.
聊天触发器节点无法获取历史消息#
¥Chat Trigger node doesn't fetch previous messages
配置聊天触发器节点时,如果你不注意会话加载的配置方式,则可能会遇到无法获取先前消息的问题。这通常表现为 workflow could not be started! 错误。
¥When you configure a Chat Trigger node, you might experience problems fetching previous messages if you aren't careful about how you configure session loading. This often manifests as a workflow could not be started! error.
在“聊天触发器”中,“加载上一个会话”选项会使用 sessionID 检索会话的先前聊天消息。当你将“加载上次会话”选项设置为“从内存加载”时,几乎总是最好在工作流中同时对聊天触发器和客服人员进行 连接同一内存节点 操作:
¥In Chat Triggers, the Load Previous Session option retrieves previous chat messages for a session using the sessionID. When you set the Load Previous Session option to From memory, it's almost always best to connect the same memory node to both the Chat Trigger and the Agent in your workflow:
- 在聊天触发器节点中,将“加载上一次会话”选项设置为“从内存”。仅当你将聊天设置为公开时,此信息才可见。
¥In your Chat Trigger node, set the Load Previous Session option to From Memory. This is only visible if you've made the chat publicly available. 2. 将一个简单内存节点附加到内存连接器。
¥Attach a Simple Memory node to the Memory connector. 3. 将同一个简单内存节点附加到代理的内存连接器。
¥Attach the same Simple Memory node to Memory connector of your Agent. 4. 在“简单内存”节点中,将“会话 ID”设置为“已连接聊天触发节点”。
¥In the Simple Memory node, set Session ID to Connected Chat Trigger Node.
你可能需要将单独的内存节点附加到聊天触发器和代理的一个例子是,如果你想在内存节点中设置会话 ID(定义如下)。
¥One instance where you may want to attach separate memory nodes to your Chat Trigger and the Agent is if you want to set the Session ID in your memory node to Define below.
如果你要从表达式中检索会话 ID,则同一个表达式必须适用于与其关联的每个节点。如果表达式与每个需要内存的节点都不兼容,你可能需要使用单独的内存节点,以便可以针对每个节点自定义会话 ID 的表达式。
¥If you're retrieving the session ID from an expression, the same expression must work for each of the nodes attached to it. If the expression isn't compatible with each of the nodes that need memory, you might need to use separate memory nodes so you can customize the expression for the session ID on a per-node basis.