Skip to content

Commit 97cb840

Browse files
authored
Print the model used in the debug files (#26)
1 parent 98ee7eb commit 97cb840

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

jupyter_ai_tutor/handlers.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ async def post(self):
2929
503,
3030
"No chat model is configured. Set one in 'Settings > AI Settings'.",
3131
)
32-
32+
model_used_string = f"/* MODEL USED: {config_manager.chat_model} */\n\n"
33+
3334
self.set_header("Content-Type", "text/event-stream")
3435
self.set_header("Cache-Control", "no-cache")
3536
self.set_header("X-Accel-Buffering", "no")
@@ -52,7 +53,7 @@ async def post(self):
5253
debug_mode = self.settings.get("jupyter_ai_tutor.debug", False)
5354
prompt_file = None
5455
answer_file = None
55-
accumulated_response = ""
56+
accumulated_response = model_used_string
5657

5758
if debug_mode:
5859
debug_dir = Path(tempfile.gettempdir()) / "jupyter-ai-tutor"
@@ -65,6 +66,7 @@ async def post(self):
6566
answer_file = debug_dir / f"{timestamp}_jupyter_tutor_answer.txt"
6667
try:
6768
with prompt_file.open("w", encoding="utf-8") as f:
69+
f.write(model_used_string)
6870
f.write("=== SYSTEM PROMPT ===\n\n")
6971
f.write(system_prompt)
7072
f.write("\n\n=== USER MESSAGE ===\n\n")

0 commit comments

Comments
 (0)