diff --git a/templates/audit/log_detail.html b/templates/audit/log_detail.html index fc05fe8..fb79ca6 100644 --- a/templates/audit/log_detail.html +++ b/templates/audit/log_detail.html @@ -15,7 +15,7 @@

基础信息

@@ -46,6 +46,11 @@
{{ log.tool_calls }}
+
+

原始输出

+
{{ log.raw_output }}
+
+ {% if log.error_message %}

错误信息

diff --git a/tests/test_audit.py b/tests/test_audit.py index 68d4af1..fc83ee1 100644 --- a/tests/test_audit.py +++ b/tests/test_audit.py @@ -62,6 +62,23 @@ def test_audit_list_page_shows_user_input_summary(client, db): assert "这是一个比较长的用户输入" in response.content.decode("utf-8") +def test_audit_detail_page_shows_raw_output(client, db): + result = AgentResult( + answer="结构化回答", + raw_output='{"answer":"结构化回答","confidence":"high"}', + status="success", + ) + log = create_audit_log("knowledge_qa", "知识库问答助手", "问题", result) + + response = client.get(reverse("audit:detail", args=[log.id])) + + content = response.content.decode("utf-8") + assert response.status_code == 200 + assert "原始输出" in content + assert "confidence" in content + assert "high" in content + + def test_create_audit_log_masks_api_keys_from_error_message(db): result = AgentResult( answer="",