feat: HESUPIPE 公司事实卡(官网硬事实+防编造规则)
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -27,15 +27,26 @@ def test_facts_concatenated_between_system_and_context():
|
||||
import asyncio
|
||||
asyncio.run(svc.chat([{"role": "user", "content": "hi"}], context="⚠️ 提醒"))
|
||||
p = svc.provider.prompts[0]
|
||||
assert "Hesu" in p # 事实在场
|
||||
assert "HESUPIPE" in p and "HDPE" in p # 建材事实在场
|
||||
assert p.index(SYSTEM_PROMPT) < p.index(COMPANY_FACTS) < p.index("⚠️ 提醒")
|
||||
|
||||
|
||||
def test_facts_absent_from_extractor_prompt():
|
||||
# extractor/evaluator 不拼事实卡(它们有自己的 prompt,不该看到公司事实)
|
||||
from app.services.ai_service import EVALUATOR_PROMPT, EXTRACTOR_PROMPT
|
||||
assert "Hesu" not in EXTRACTOR_PROMPT
|
||||
assert "Hesu" not in EVALUATOR_PROMPT
|
||||
assert "HESUPIPE" not in EXTRACTOR_PROMPT
|
||||
assert "HDPE" not in EXTRACTOR_PROMPT
|
||||
assert "HESUPIPE" not in EVALUATOR_PROMPT
|
||||
assert "HDPE" not in EVALUATOR_PROMPT
|
||||
|
||||
|
||||
def test_facts_no_auto_words():
|
||||
# 建材化红线: 事实卡不得残留汽车项目词汇
|
||||
# (只查 COMPANY_FACTS——SYSTEM_PROMPT 属 Task 3,不在本测试管辖)
|
||||
for word in ("BYD", "Hesu Auto", "Toyota"):
|
||||
assert word not in COMPANY_FACTS, word
|
||||
for word in ("vehicle", "sedan", "suv"):
|
||||
assert word not in COMPANY_FACTS.lower(), word
|
||||
|
||||
|
||||
from app.services.boundary_filter import (
|
||||
|
||||
Reference in New Issue
Block a user