VEDAGI1 commited on
Commit
94afb80
·
verified ·
1 Parent(s): c78a9de

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -1
app.py CHANGED
@@ -867,7 +867,20 @@ def handle(user_msg: str, files: list, yield_update) -> str:
867
  total_duration_ms=_duration_ms
868
  )
869
 
870
- return _sanitize_text(final_report)
 
 
 
 
 
 
 
 
 
 
 
 
 
871
  else:
872
  chat_input = redacted_in if (PHI_MODE and not ALLOW_EXTERNAL_PHI) else safe_in
873
  prompt = f"{GENERAL_CONVERSATION_PROMPT}\n\nUser: {chat_input}\nAssistant:"
 
867
  total_duration_ms=_duration_ms
868
  )
869
 
870
+ # Append code traceability section
871
+ # "Every finding traces back to specific lines of generated Python code"
872
+ traceability_section = (
873
+ f"\n\n---\n\n"
874
+ f"<details>\n"
875
+ f"<summary>📜 <strong>View Analysis Code</strong> (click to expand)</summary>\n\n"
876
+ f"The findings in this report were generated by the following Python code, "
877
+ f"executed in a sandboxed environment:\n\n"
878
+ f"```python\n{analysis_script}\n```\n\n"
879
+ f"**Session ID:** `{session_id}`\n\n"
880
+ f"</details>"
881
+ )
882
+
883
+ return _sanitize_text(final_report) + traceability_section
884
  else:
885
  chat_input = redacted_in if (PHI_MODE and not ALLOW_EXTERNAL_PHI) else safe_in
886
  prompt = f"{GENERAL_CONVERSATION_PROMPT}\n\nUser: {chat_input}\nAssistant:"