From 69d41e24817ec34145c67789111fc7e39b669126 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Sat, 12 Sep 2026 09:23:00 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20README=E8=A1=A5=E4=BA=BA=E5=B7=A5?= =?UTF-8?q?=E5=B7=A5=E5=8D=95=E8=87=AA=E5=8A=A8=E6=B2=89=E6=B7=80=E7=9F=A5?= =?UTF-8?q?=E8=AF=86=E5=BA=93=E7=AB=A0=E8=8A=82(=E8=A7=A6=E5=8F=91/?= =?UTF-8?q?=E5=85=A5=E5=BA=93=E6=9D=A1=E4=BB=B6/internal=E6=8E=92=E9=99=A4?= =?UTF-8?q?/=E5=B9=82=E7=AD=89/rag=20API=E9=80=9A=E9=81=93/=E8=BD=AF?= =?UTF-8?q?=E9=99=8D=E7=BA=A7/E2E=E5=AE=9E=E6=B5=8B)+=E6=96=B0=E5=A2=9Epar?= =?UTF-8?q?ams=20ticket=5Fplatform=5Fkb=5Fname?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index 3443765..f7559f9 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,20 @@ | ticket_followup_max | 2 | agent 回复后客户追问上限,超限自动转人工 | | ticket_agent_fail_max | 3 | agent 基础设施连续失败轮数上限,超限转人工 | | ticket_agent_username | admin | agent 检索知识库用的平台账号('0'机构) | +| ticket_platform_kb_name | 平台知识库 | 人工工单沉淀的目标知识库名('0'机构,不存在时自动创建 bge-m3 文本库) | + +## 人工工单自动沉淀知识库(2026-09-12 上线,kb_ingest.py) + +人工处理过的工单关闭后自动归档进「平台知识库」,下次同类问题 agent 检索即可自动回答,形成闭环。 + +- 触发:`core.ticket_confirm`(客户确认解决→closed/resolved)成功后 `schedule_ingest(ticket_id)` 派发后台任务。 +- 入库条件:工单 close_reason=resolved **且**存在人工对客回复(sender_type=staff, visibility=customer);纯 agent 自答的不沉淀。 +- 正文:客户问题 + 处理过程(仅客户可见消息)+ 结论(最后一条客服答复)。**internal 内部备注一律排除**,防内部排查信息经 agent 回复泄露给客户。 +- 幂等:同 KB 同名文档(工单-<标题>.md)已存在则跳过。 +- 通道:只走 rag 对外 API(kb_list/kb_create/doc_upload),不直写 rag 表;仅 SQL 读 rag_documents 查重。身份与 agent.py 同款(params ticket_agent_username 的 '0' 机构账号,经 pipeline_service.rag_client 取 Bearer key)。 +- 软降级:pipeline_service/rag 不可用、API 异常、上传失败只记日志,绝不影响工单关闭动作。 + +E2E 实测(测试机 2026-09-12):人工工单关闭→自动生成 .md 入库(status=done, 8 chunks)→`_platform_rag_search` 检索该问题命中 score=1.0/0.97/0.71;internal 备注未泄漏;测试工件已清理。 ## 安装