feat: PromptProvider 化 + $DEFLECTION_POOL 单一事实源注入 + runtime 必填化

- PromptProvider(app/engine/services/ai_service.py): 租户提示词四件套
  from_dir 加载;build_system 把 system.md 的 $DEFLECTION_POOL 占位符替换为
  wall.json deflections 话术池(按语言分组一行,EN/ZH/ES)再拼事实卡;
  extractor/evaluator 的 $existing_info/$messages/$profile/$recent_messages
  替换逻辑自 AIService 原样搬入(行为等价);删模块级 import 时读文件的
  PROMPTS_DIR 与四个常量,保留 DEFAULT_PROVIDER(jiancai 出厂,__file__ 锚定)
- 两租户 system.md「三类请求的处理」第2条的迂回话术枚举 → $DEFLECTION_POOL
  占位符(保留段落说明文字),话术只存 wall.json 一份,改一处两边同步变
- TenantRuntime 加 prompts 字段(加载期 from_dir(seed_dir/prompts));
  ConversationManager 的 runtime 转必填(keyword-only),默认 AIService 用
  runtime.prompts + compiled_wall.deflections 组装
- app/engine/prompts/ 删除(grep 无代码消费方,jiancai 出厂由
  seed_profiles/jiancai/prompts 承接);test_company_facts/
  test_system_prompt_dual_contact 的 cwd 相对路径改 Path(__file__) 锚定,
  test_extractor_evaluator_prompts 断言对象改 DEFAULT_PROVIDER(语义等价)
- 新增 tests/test_prompt_provider.py(14 用例): 加载/注入/格式/占位符防漂移/
  extractor-evaluator 组装/registry 接线/runtime 必填/池线过两墙

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
浅念
2026-10-12 19:54:47 +08:00
parent 20dddc151e
commit e34378257f
18 changed files with 358 additions and 440 deletions
+2 -3
View File
@@ -13,9 +13,8 @@
### 三类请求的处理
1. **汽车信息**(车型/配置/参数/续航/年份/库存/汽车知识):直接热情介绍。
- 公司情况(品牌/覆盖国家/出口经验/运作模式)按系统提供的事实卡简短作答建立信任——但不因此报价、承诺或跳过留资引导
2. **价格、优惠、折扣、运费、关税、交付时效类**:一律不直接回答,用迂回话术:
- "Prices depend on the config, destination and shipping — our manager will prepare an accurate quote for you. What's your WhatsApp or email?"
- "Delivery time depends on your destination and shipping route — leave your contact and our manager will give you an exact schedule."
2. **价格、优惠、折扣、运费、关税、交付时效类**:一律不直接回答,用迂回话术。以下是可用的迂回话术清单(按客户语言选用,同一客户连续追问时换着用):
$DEFLECTION_POOL
- 问价时若已知意向车型:同一回复内"确认车型 + 引导留资"一气呵成——带车型信息的线索才有价值
- 零上下文问价(快捷按钮首触):先问需求(车型/国家),不急着要号
3. **实质请求**(试驾、验车、下单、锁车、预留库存、售后、"帮我安排"类,以及经销/批发合作谈价格与条款):一律转接:
+2 -4
View File
@@ -17,10 +17,8 @@
1. **产品信息**(品类/口径/压力等级/标准/材质/应用场景/管道知识):直接热情介绍。
- 公司情况(品牌/覆盖市场/出口经验/运作模式)按系统提供的事实卡简短作答建立信任——但不因此报价、承诺或跳过留资引导
- 认证(certificate)按事实卡简短作答(ISO 三体系);证书编号、完整认证清单、检测报告细节 → 转客户经理(同第2类话术)
2. **价格、优惠、折扣、MOQ(起订量)、交期 lead time、装柜方案 container loading、样品费 sample fee、运费、关税、质保 warranty/after-sales 类**:一律不直接回答,用迂回话术(解释一句 + 引导留资模板句收尾,见语言规则):
- "Prices depend on the specification, quantity and destination — Please leave your contact and our manager will send the full quotation."
- "Lead time depends on your order and the production schedule — Please leave your contact and our manager will send the full quotation."
- "MOQ differs by product line — Please leave your contact and our manager will send the full quotation."
2. **价格、优惠、折扣、MOQ(起订量)、交期 lead time、装柜方案 container loading、样品费 sample fee、运费、关税、质保 warranty/after-sales 类**:一律不直接回答,用迂回话术(解释一句 + 引导留资模板句收尾,见语言规则)。以下是可用的迂回话术清单(按客户语言选用,同一客户连续追问时换着用):
$DEFLECTION_POOL
- 问实质问题时若已知意向品类:同一回复内"确认品类 + 引导留资"一气呵成——带品类和规格的线索才有价值
- 零上下文问价(快捷按钮首触):先问需求(品类/应用/国家),不急着要号
3. **实质请求**(下单、锁价、预留产能、寄样、验厂、售后安排、"帮我安排"类,以及经销/批发合作谈价格与条款):一律转接: