feat(audit): 增加场景筛选与日志摘要展示
This commit is contained in:
@@ -27,6 +27,41 @@ def test_audit_list_page_shows_log(client, db):
|
||||
assert "知识库问答助手" in response.content.decode("utf-8")
|
||||
|
||||
|
||||
def test_audit_list_can_filter_by_scenario(client, db):
|
||||
create_audit_log(
|
||||
"knowledge_qa",
|
||||
"知识库问答助手",
|
||||
"制度问题",
|
||||
AgentResult(answer="回答一", status="success"),
|
||||
)
|
||||
create_audit_log(
|
||||
"quality_analysis",
|
||||
"质量异常分析助手",
|
||||
"质量问题",
|
||||
AgentResult(answer="回答二", status="success"),
|
||||
)
|
||||
|
||||
response = client.get(reverse("audit:list"), {"scenario_id": "knowledge_qa"})
|
||||
|
||||
content = response.content.decode("utf-8")
|
||||
assert response.status_code == 200
|
||||
assert "知识库问答助手" in content
|
||||
assert "质量异常分析助手" not in content
|
||||
|
||||
|
||||
def test_audit_list_page_shows_user_input_summary(client, db):
|
||||
create_audit_log(
|
||||
"knowledge_qa",
|
||||
"知识库问答助手",
|
||||
"这是一个比较长的用户输入,用于确认列表页会展示输入摘要。",
|
||||
AgentResult(answer="回答", status="success"),
|
||||
)
|
||||
|
||||
response = client.get(reverse("audit:list"))
|
||||
|
||||
assert "这是一个比较长的用户输入" in response.content.decode("utf-8")
|
||||
|
||||
|
||||
def test_create_audit_log_masks_api_keys_from_error_message(db):
|
||||
result = AgentResult(
|
||||
answer="",
|
||||
|
||||
Reference in New Issue
Block a user