feat(application-form-fill): 接入自动填表工作流触发
This commit is contained in:
45
tests/test_application_form_fill_trigger.py
Normal file
45
tests/test_application_form_fill_trigger.py
Normal file
@@ -0,0 +1,45 @@
|
||||
import pytest
|
||||
|
||||
from review_agent.models import Conversation
|
||||
from review_agent.skill_router import route_message_intent
|
||||
|
||||
|
||||
pytestmark = pytest.mark.django_db
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"content",
|
||||
[
|
||||
"帮我填注册证",
|
||||
"给我这个内容对应的表格",
|
||||
"为我该方案生成申报模板",
|
||||
"请自动填表并生成表格",
|
||||
"生成安全和性能基本原则清单",
|
||||
],
|
||||
)
|
||||
def test_rule_router_starts_application_form_fill_for_keywords(monkeypatch, django_user_model, content):
|
||||
user = django_user_model.objects.create_user(username="owner", password="pass")
|
||||
conversation = Conversation.objects.create(user=user, title="会话")
|
||||
monkeypatch.setattr(
|
||||
"review_agent.skill_router._route_with_llm",
|
||||
lambda conversation, content, attachments: (_ for _ in ()).throw(ValueError("fallback")),
|
||||
)
|
||||
|
||||
route = route_message_intent(conversation, content)
|
||||
|
||||
assert route.action == "application_form_fill"
|
||||
assert route.workflow_type == "application_form_fill"
|
||||
assert route.starts_application_form_fill
|
||||
|
||||
|
||||
def test_rule_router_does_not_misroute_normal_chat(monkeypatch, django_user_model):
|
||||
user = django_user_model.objects.create_user(username="owner", password="pass")
|
||||
conversation = Conversation.objects.create(user=user, title="会话")
|
||||
monkeypatch.setattr(
|
||||
"review_agent.skill_router._route_with_llm",
|
||||
lambda conversation, content, attachments: (_ for _ in ()).throw(ValueError("fallback")),
|
||||
)
|
||||
|
||||
route = route_message_intent(conversation, "你好,解释一下法规背景")
|
||||
|
||||
assert route.action == "normal_chat"
|
||||
Reference in New Issue
Block a user