Pulastya B commited on
Commit
f898051
·
1 Parent(s): 49fbcb2

fix: Extract plots from ALL visualization tools

Browse files

- Check for plot/visualiz/chart/heatmap/scatter/histogram in tool names
- Extract output_path from visualization tools (not just plot_paths)
- Add type field (html vs image) for proper rendering
- Generate descriptive titles from tool names
- Fixes correlation_heatmap and other interactive plots not showing
- Now works for single-step visualization tasks

Files changed (1) hide show
  1. src/orchestrator.py +20 -3
src/orchestrator.py CHANGED
@@ -987,13 +987,30 @@ You are a DOER. Complete workflows based on user intent."""
987
  "url": f"/outputs/{report_path.replace('./outputs/', '')}"
988
  })
989
 
990
- # === COLLECT PLOT FILES ===
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
991
  if "plot_paths" in nested_result:
992
  for plot_path in nested_result["plot_paths"]:
993
  plots.append({
994
- "title": plot_path.split("/")[-1].replace("_", " ").replace(".png", "").title(),
995
  "path": plot_path,
996
- "url": f"/outputs/{plot_path.replace('./outputs/', '')}"
 
997
  })
998
 
999
  # === COLLECT DATA FILES ===
 
987
  "url": f"/outputs/{report_path.replace('./outputs/', '')}"
988
  })
989
 
990
+ # === COLLECT VISUALIZATION FILES (interactive plots, charts, etc.) ===
991
+ elif "plot" in tool.lower() or "visualiz" in tool.lower() or "chart" in tool.lower() or "heatmap" in tool.lower() or "scatter" in tool.lower() or "histogram" in tool.lower():
992
+ if "output_path" in nested_result:
993
+ plot_path = nested_result["output_path"]
994
+ # Extract plot title from tool name or filename
995
+ plot_title = tool.replace("generate_", "").replace("interactive_", "").replace("_", " ").title()
996
+ if not plot_title or plot_title == "Output Path":
997
+ plot_title = plot_path.split("/")[-1].replace("_", " ").replace(".html", "").replace(".png", "").title()
998
+
999
+ plots.append({
1000
+ "title": plot_title,
1001
+ "path": plot_path,
1002
+ "url": f"/outputs/{plot_path.replace('./outputs/', '')}",
1003
+ "type": "html" if plot_path.endswith(".html") else "image"
1004
+ })
1005
+
1006
+ # === COLLECT PLOT FILES (from plot_paths key) ===
1007
  if "plot_paths" in nested_result:
1008
  for plot_path in nested_result["plot_paths"]:
1009
  plots.append({
1010
+ "title": plot_path.split("/")[-1].replace("_", " ").replace(".png", "").replace(".html", "").title(),
1011
  "path": plot_path,
1012
+ "url": f"/outputs/{plot_path.replace('./outputs/', '')}",
1013
+ "type": "html" if plot_path.endswith(".html") else "image"
1014
  })
1015
 
1016
  # === COLLECT DATA FILES ===