Pulastya B commited on
Commit
f23a49f
·
1 Parent(s): 2caa5f7

Add comprehensive debug logging for plot extraction and URL generation

Browse files

- Log output_path value from tool result
- Log plot details when added to array (title, url, type)
- Log final plots array sent to frontend with all details
- Help diagnose why plots aren't visible in UI

Files changed (1) hide show
  1. src/orchestrator.py +12 -0
src/orchestrator.py CHANGED
@@ -1005,6 +1005,8 @@ You are a DOER. Complete workflows based on user intent."""
1005
  print(f"[DEBUG] result keys: {list(result.keys())}")
1006
  print(f"[DEBUG] nested_result keys: {list(nested_result.keys()) if isinstance(nested_result, dict) else 'not a dict'}")
1007
  print(f"[DEBUG] output_path in nested_result: {'output_path' in nested_result if isinstance(nested_result, dict) else False}")
 
 
1008
 
1009
  # === EXTRACT MODEL METRICS ===
1010
  if tool == "train_baseline_models":
@@ -1114,6 +1116,10 @@ You are a DOER. Complete workflows based on user intent."""
1114
  "url": f"/outputs/{plot_path.replace('./outputs/', '')}",
1115
  "type": "html" if plot_path.endswith(".html") else "image"
1116
  })
 
 
 
 
1117
 
1118
  # === COLLECT PLOT FILES (from plot_paths key) ===
1119
  if "plot_paths" in nested_result:
@@ -2576,6 +2582,12 @@ You are a DOER. Complete workflows based on user intent."""
2576
  artifacts_data = enhanced_summary.get("artifacts", {})
2577
  plots_data = enhanced_summary.get("plots", [])
2578
  print(f"✅ Enhanced summary generated with {len(plots_data)} plots, {len(metrics_data)} metrics")
 
 
 
 
 
 
2579
  except Exception as e:
2580
  print(f"⚠️ Enhanced summary generation failed: {e}")
2581
  import traceback
 
1005
  print(f"[DEBUG] result keys: {list(result.keys())}")
1006
  print(f"[DEBUG] nested_result keys: {list(nested_result.keys()) if isinstance(nested_result, dict) else 'not a dict'}")
1007
  print(f"[DEBUG] output_path in nested_result: {'output_path' in nested_result if isinstance(nested_result, dict) else False}")
1008
+ if isinstance(nested_result, dict) and "output_path" in nested_result:
1009
+ print(f"[DEBUG] output_path value: {nested_result['output_path']}")
1010
 
1011
  # === EXTRACT MODEL METRICS ===
1012
  if tool == "train_baseline_models":
 
1116
  "url": f"/outputs/{plot_path.replace('./outputs/', '')}",
1117
  "type": "html" if plot_path.endswith(".html") else "image"
1118
  })
1119
+ print(f"[DEBUG] Added plot to array:")
1120
+ print(f"[DEBUG] title: {plot_title}")
1121
+ print(f"[DEBUG] url: /outputs/{plot_path.replace('./outputs/', '')}")
1122
+ print(f"[DEBUG] type: {'html' if plot_path.endswith('.html') else 'image'}")
1123
 
1124
  # === COLLECT PLOT FILES (from plot_paths key) ===
1125
  if "plot_paths" in nested_result:
 
2582
  artifacts_data = enhanced_summary.get("artifacts", {})
2583
  plots_data = enhanced_summary.get("plots", [])
2584
  print(f"✅ Enhanced summary generated with {len(plots_data)} plots, {len(metrics_data)} metrics")
2585
+
2586
+ # DEBUG: Log plots array details
2587
+ if plots_data:
2588
+ print(f"[DEBUG] Plots array contains {len(plots_data)} items:")
2589
+ for idx, plot in enumerate(plots_data):
2590
+ print(f"[DEBUG] Plot {idx+1}: title='{plot.get('title')}', url='{plot.get('url')}', type='{plot.get('type')}'")
2591
  except Exception as e:
2592
  print(f"⚠️ Enhanced summary generation failed: {e}")
2593
  import traceback