fix(application-form-fill): 优先路由填表提示并支持rar预览
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import pytest
|
||||
|
||||
from review_agent.models import Conversation
|
||||
from review_agent.models import Conversation, FileAttachment
|
||||
from review_agent.skill_router import route_message_intent
|
||||
|
||||
|
||||
@@ -43,3 +43,31 @@ def test_rule_router_does_not_misroute_normal_chat(monkeypatch, django_user_mode
|
||||
route = route_message_intent(conversation, "你好,解释一下法规背景")
|
||||
|
||||
assert route.action == "normal_chat"
|
||||
|
||||
|
||||
def test_application_form_fill_prompt_preempts_attachment_reader_llm(monkeypatch, tmp_path, django_user_model):
|
||||
user = django_user_model.objects.create_user(username="owner", password="pass")
|
||||
conversation = Conversation.objects.create(user=user, title="会话")
|
||||
archive_path = tmp_path / "第1章_监管信息.rar"
|
||||
archive_path.write_bytes(b"rar")
|
||||
FileAttachment.objects.create(
|
||||
conversation=conversation,
|
||||
user=user,
|
||||
original_name="第1章_监管信息.rar",
|
||||
storage_path=str(archive_path),
|
||||
file_size=archive_path.stat().st_size,
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
"review_agent.skill_router._route_with_llm",
|
||||
lambda conversation, content, attachments: (_ for _ in ()).throw(
|
||||
AssertionError("明确自动填表意图不应进入 LLM 路由")
|
||||
),
|
||||
)
|
||||
|
||||
route = route_message_intent(
|
||||
conversation,
|
||||
"请基于当前对话最近成功汇总的产品资料,自动提取产品关键信息并填入申报文件模板,优先生成注册证 Word 和字段来源追溯清单。",
|
||||
)
|
||||
|
||||
assert route.action == "application_form_fill"
|
||||
assert route.source == "rule_preflight"
|
||||
|
||||
Reference in New Issue
Block a user