# n8n 中文客服分流 / Chinese support triage

参考 n8n **2.42.6**，Manual Trigger 1、Code 2、HTTP Request 4.2。JSON 结构及其中代码与表达式通过离线 fixture；该版本的编辑器导入、真实执行及模型费用未验证。

## 导入与运行

1. 新建隔离测试工作流，从编辑器菜单选择 **Import from File**，载入 `support-triage.workflow.json`。保持 inactive；只有手动触发器。
2. 创建通用 **Header Auth** 凭据：Name 为 `Authorization`，Value 为 `Bearer <自己的 apizt Key>`。把它保存在凭据管理器里。
3. 在 **apizt Chat** 节点重新选择本地凭据。文件中的 `SELECT_YOUR_LOCAL_CREDENTIAL` 是占位 ID，不是可用凭据，也不引用作者账户。
4. 核对完整 URL `https://api.apizt.com/v1/chat/completions`、`glm-5.3` 的权限与价格。**Sample ticket** 节点只产生一条脱敏的虚构工单，可修改其 `ticket_id`、`text`、`model`。
5. 先运行 **Sample ticket** 和 **Prepare request** 两个节点检查请求。模型执行前需要你在客户端手动点击执行完整工作流；会发送一次 POST，可能计费。
6. 检查最后一个节点的 `ticket_id`、`status`、`category`、`urgency`、`summary`、`request_id`、`usage`。`ready_for_review` 只表示字段合同通过，需要人工审核；`billedUsd: null` 表示未核实实扣。

类别为 billing/account/sales/technical/other；紧急程度为 normal/high。输入限定 1-2000 个字符，ID 限定 1-64 个 ASCII 字母、数字、下划线或连字符。输出不允许额外字段、ID 变更、无效枚举、截断或超过 120 字的摘要。模型不返回合法 JSON 时会标记 `invalid_output`，不会当作成功。

连接错误、408、409、5xx 或没有 HTTP 状态进入 `unknown`；其他非 2xx 进入 `rejected`。不输出原始错误文本、不跟随重定向、HTTP 自动重试关闭、单次超时 30 秒。关闭了执行成功/失败数据与手动执行保存；实例的全局日志策略可能另有保留，请核对自己的设置。摘要本身仍可能含用户信息，正式输入前必须脱敏。

此模板不使用 CSV，不循环，不发送消息，不接入真实工单系统，不保存防重复门禁。重复点击会发新请求。未知结果必须核对 n8n 执行和 apizt 账户记录；切勿直接重跑整个工作流。

## English

Import `support-triage.workflow.json` through **Import from File** in an isolated n8n editor. Create a generic **Header Auth** credential (`Authorization` / `Bearer <your own key>`) and select it in **apizt Chat**. The credential ID in this file is a placeholder. Keep the workflow inactive, review the sample input and prepared body, verify model permissions/pricing, then manually run once.

The final node validates the ticket ID, exact JSON keys, categories, urgency and summary length. It rejects truncated or malformed replies. `ready_for_review` requires a human decision; token usage is not verified billing. Unknown network/server outcomes require record review before resubmission. Retries and redirects are disabled, but there is no persisted deduplication gate. Re-executing creates a new request. Source target: n8n 2.42.6; actual editor import and execution were not tested. Fixtures are synthetic.

[Official import/export](https://docs.n8n.io/workflows/export-import/) · [HTTP Request](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.httprequest/) · [Source/version record](../docs/ecosystem-integrations.md)
