From 20cab6ed646a025fb03cf9151d4498bc5cf67c80 Mon Sep 17 00:00:00 2001 From: OoO Date: Wed, 13 May 2026 09:23:26 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A3=9C=E4=B8=8A=20RAG=20hit=20logger=20?= =?UTF-8?q?=E5=9B=9E=E6=AD=B8=E6=B8=AC=E8=A9=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/test_ai_call_logger.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/test_ai_call_logger.py b/tests/test_ai_call_logger.py index c6b2bc0..193e8d7 100644 --- a/tests/test_ai_call_logger.py +++ b/tests/test_ai_call_logger.py @@ -144,6 +144,17 @@ def test_context_manager_set_error_without_raise(reset_state): assert 'timeout' in rec['error'] +def test_context_manager_marks_rag_hit(reset_state): + captured = reset_state + with log_ai_call('openclaw_qa', 'gcp_ollama', 'qwen3:14b') as ctx: + ctx.set_rag_hit(True) + + assert _wait_for_async(captured, 1) + rec = captured[0] + assert rec['status'] == 'ok' + assert rec['rag_hit'] is True + + # ───────────────────────────────────────────────────────────────────────────── # decorator 測試 # ─────────────────────────────────────────────────────────────────────────────