From 3d92c32b274e714fa5d8d73ee9c4d4fe88af1a44 Mon Sep 17 00:00:00 2001 From: Nicolas Brichet Date: Fri, 10 Jul 2026 16:19:37 +0200 Subject: [PATCH] Print the model used in the debug files --- jupyter_ai_tutor/handlers.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/jupyter_ai_tutor/handlers.py b/jupyter_ai_tutor/handlers.py index 0c3f301..0aa56de 100644 --- a/jupyter_ai_tutor/handlers.py +++ b/jupyter_ai_tutor/handlers.py @@ -29,7 +29,8 @@ async def post(self): 503, "No chat model is configured. Set one in 'Settings > AI Settings'.", ) - + model_used_string = f"/* MODEL USED: {config_manager.chat_model} */\n\n" + self.set_header("Content-Type", "text/event-stream") self.set_header("Cache-Control", "no-cache") self.set_header("X-Accel-Buffering", "no") @@ -52,7 +53,7 @@ async def post(self): debug_mode = self.settings.get("jupyter_ai_tutor.debug", False) prompt_file = None answer_file = None - accumulated_response = "" + accumulated_response = model_used_string if debug_mode: debug_dir = Path(tempfile.gettempdir()) / "jupyter-ai-tutor" @@ -65,6 +66,7 @@ async def post(self): answer_file = debug_dir / f"{timestamp}_jupyter_tutor_answer.txt" try: with prompt_file.open("w", encoding="utf-8") as f: + f.write(model_used_string) f.write("=== SYSTEM PROMPT ===\n\n") f.write(system_prompt) f.write("\n\n=== USER MESSAGE ===\n\n")