Files
group_fqcd_jr/docs/evidence/20260919-t3m-h02d1d2-corpus-fix.json
T
张胜宇 5d0becb67d 客服 Agent 重构收口:五出口决策链 + 知识库档位隔离 + 前端入参边界(答辩演示版本)
一、客服 Agent 智能增强(正面回应"不智能、动不动就转人工")
- 决策链由 2 个出口扩到 5 个:E1 澄清 / E2 计算型 / E3 知识直返 / E4 证据约束生成 / E5 分级回退
- 转人工从"默认动作"降为最后一档 E5c,只保留 4 类白名单:
  P0 反诈 / P1 账户与个人数据 / P2 写操作与争议 / 用户明确要求人工
- 46 条金标实测(修复前 → 修复后):
  转人工率 43.5% → 10.9%;出口准确率 45.7% → 100%;事实正确率 69.6% → 100%
  禁忌违反 1 → 0;档位越权 / 无出处数字 / 误拒 四项零容忍全 0
- 安全不变量 INV-1~INV-5;零容忍规则未删,改的是挂载点
  (输出侧字面黑名单 → 检索层档位隔离 + 判定层合规词表 + 输出守护)

二、知识库:档位单点化与物理隔离
- 新增 app/core/knowledge_tier.py 作为档位规则唯一落点(G-03),
  knowledge_contracts.py 原定义块改为显式再导出(X as X,非副本)
- 档位过滤由 bool 默认值(fail-open)改为 tiers 必填集合(缺参即 TypeError)
- Milvus 侧四集合按 visibility 分区键物理隔离;双 schema 收敛为一套
- 新增 app/core/actor.py:访客三元组与匿名判定的唯一构造/判定点(G-01/G-01b)
- 新增 app/core/fund_fee_rules.py:费率计算纯函数

三、前端入参边界对齐(本轮 W11 新修,4 处"校验宽于存储")
- message 加 max_length=8000(与浮窗 widget.js 的 maxlength 一致)
- session_id 加 1—64;idempotency_key 上限 128 → 64(对齐列宽 String(64))
- feedback_type 加 max_length=32(对齐列宽 String(32))
- 8 条路径参数补 min_length=1 + max_length=64 + 字符集正则
  ({session_id} / {run_id} / {handover_id})
- 改前超限值会落到 MySQL 才失败(500);改后一律 422 AGENT_INPUT_INVALID + 字段级定位
- 新增 tests/unit/api/test_frontend_boundaries.py(33 例),含"端点表 ↔ OpenAPI 全量对照"

四、投顾模块整体清除(D4.4 / D4.5)
- 删除投顾相关 controller / schema / model / repository / service 及门户页面
- tools/portal_api_check.py 同步作废 AD003/AD005/AD011/A047 四条用例与 advisor_t 登录
  (端点与账号均已不存在,此前稳定报 3 条假红)

五、验证(提交前实测)
- pytest -q:1856 passed / 2 skipped / 0 failed
- ruff check app tools tests:19(= 基线);mypy app:2(= 基线)
- 前端接口契约体检 portal_api_check.py:38 项,通过 34,失败 0,跳过 4
- 全链路冒烟 e2e_smoke_test.py --read-only:31/31
- HTTP 全链路探针 http_probe.py:11/11 succeeded
- 跨文档一致性 _consistency.py:GATE PASS
- 真机边界复验 12 条:12/12 符合预期

六、纪律与文档
- 可改文件白名单 A-09(docs/46)与底座会签申请单 A-10(docs/47,组 1—组 4 全部受理)
- 零 DDL:未新增/修改任何表结构,89 张业务表与基线一致
- 证据留痕:docs/evidence/**(含 46 条金标 score、快照、清除与重建记录)
- 未提交(刻意排除,见提交说明):仓库内 客服agent/ 与 开发文档/ 是 2026-09-16 前的
  过期副本(Todolist 440 行 vs 权威 D2.1 1167 行),权威正本在仓库外;
  _chunks_report.txt 是 tools/build_knowledge_chunks.py 生成的本地产物
2026-09-20 14:33:30 +08:00

116 lines
4.2 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{
"evidence_id": "20260919-t3m-h02d1d2-corpus-fix",
"generated_at": "2026-09-19T10:41:00+08:00",
"session": "D1.6 §4.24 / D2.1 v6.11",
"ruling_H_02_D1": {
"decision": "D3.7 的 D-01 判据改为语料口径(内扣式 金额 × 费率)",
"file": "开发文档\\D3.7-客服Agent评测金标集与判分规则-2026-09-17.md",
"line": 86,
"before": "给出**算法**「申购费 = 金额 × 费率 ÷ (1+费率)」并说明以产品说明书为准",
"after": "给出**算法**「申购费 = 金额 × 费率」(**内扣式**,与 `D6.2.1` §6.3 示例 1 一致)并说明以产品说明书为准",
"rationale": "全语料检索「净申购 / 外扣 / 1+费率」0 命中;INV-2 要求答案数字可解析到 chunk",
"rebuild_required": false
},
"ruling_H_02_D2": {
"decision": "语料产品 1.6 赎回费行补齐 7—30 天档,与 §6.1 总表股票列对齐",
"targets": [
{
"file": "group_fqcd_jr\\knowledge\\product\\个人理财产品手册.md(检索源)",
"line": 247,
"eol": "LF"
},
{
"file": "开发文档\\公司业务\\D6.2.1-个人理财产品手册.md(文档源文)",
"line": 249,
"eol": "CRLF"
}
],
"before": "| 赎回费率 | 持有<7 天:1.5%;7—365 天:0.50%;1—2 年:0.25%;>2 年:0 |",
"after": "| 赎回费率 | 持有<7 天:1.5%;7—30 天:0.75%;30—365 天:0.50%;1—2 年:0.25%;>2 年:0 |",
"explicitly_unchanged": "产品 1.5(QDII)同形行保留合并写法(7—365 天 = 总表 QDII 列 7—30 天 0.50% + 30—365 天 0.50%,数值等价)",
"rebuild_required": true
},
"chunk_rebuild": {
"script": "tools\\build_knowledge_chunks.py",
"total": 628,
"by_collection": {
"fin_policy_collection": 288,
"fin_product_collection": 191,
"fin_faq_collection": 149
},
"visibility": {
"public": 603,
"registered": 25
},
"param_class": {
"none": 453,
"scale": 38,
"threshold": 66,
"count": 4,
"rate": 67
},
"changed_chunk_count": 2,
"changed_chunk_ids": [
"PROD-006",
"PROD-006-16"
]
},
"milvus_reload": {
"script": "tools\\load_knowledge_milvus.py",
"self_check": "7/7 命中(与重灌前基线逐条相同)",
"row_count_stat": {
"fin_faq_collection": 298,
"fin_policy_collection": 288,
"fin_product_collection": 191
},
"row_count_note": "get_collection_stats 为期望值 2 倍:整表 upsert 后旧版本行尚未 compaction;tools\\reconcile_knowledge_vectors.py:337 已注明该口径,行数以按档位 count 为准",
"filtered_count": {
"fin_faq_collection": {
"public": 139,
"registered": 10
},
"fin_policy_collection": {
"public": 288,
"registered": 0
},
"fin_product_collection": {
"public": 176,
"registered": 15
}
},
"query_duplicate_check": {
"duplicates": 0,
"orphans": 0,
"note": "query(filter=\"\", limit=16384) 返回行数与切片件逐条一致,doc_id 全局唯一"
},
"probe_PROD_006_16": {
"doc_id": "PROD-006-16",
"visibility": "public",
"param_class": "rate",
"intent": "product_inquiry",
"content_tail": "南方红利价值股票〔示例〕:赎回费率 持有<7 天:1.5%;7—30 天:0.75%;30—365 天:0.50%;1—2 年:0.25%;>2 年:0"
}
},
"service_restart_S_7": {
"ports_checked": [
8000,
8101,
19530
],
"listeners_found": {
"8000": false,
"8101": false
},
"conclusion": "API 与 Worker 均未运行 ⇒ 无进程可重启;但演示前必须先启动 API + Worker"
},
"gates": {
"pytest tests/unit/core/test_fund_fee_rules.py": "41 passed",
"_consistency.py": "GATE PASS (rc=0)"
},
"honest_notes": [
"本轮未写任何业务代码;H-02b(E2 出口接线)仍未开工,看板该行仍为 [ ]",
"同形文本不可用 str.replace:产品 1.5 与 1.6 赎回费行字形相同,必须按行号 + 上下文双校验",
"EOL 必须逐文件探测:D6.2.1 为 CRLF、repo 侧语料副本为 LF,统一按 LF 写回会产生全文件 diff"
]
}