From 43196f79e623980e23d20bd7e33eb254a11b1e5c Mon Sep 17 00:00:00 2001 From: bruce Date: Sat, 30 May 2026 00:51:19 +0800 Subject: [PATCH] =?UTF-8?q?feat(audit):=20=E8=A1=A5=E5=85=85=E5=8E=9F?= =?UTF-8?q?=E5=A7=8B=E6=A8=A1=E5=9E=8B=E8=BE=93=E5=87=BA=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/audit/log_detail.html | 7 ++++++- tests/test_audit.py | 17 +++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) 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="",