Spaces:
Running
Running
Pulastya B
commited on
Commit
·
55d3b25
1
Parent(s):
7ea590f
fix: Extract plots from workflow_history like reports
Browse files- Use same pattern as ydata_profiling report extraction
- Check workflow_history for plot tool names
- Extract output_path from step.result or step.arguments
- Support all interactive visualization tools
- ACTUALLY WORKS NOW - generates View Plot buttons
FRRONTEEEND/components/ChatInterface.tsx
CHANGED
|
@@ -161,9 +161,20 @@ export const ChatInterface: React.FC<{ onBack: () => void }> = ({ onBack }) => {
|
|
| 161 |
// Extract report paths from workflow history
|
| 162 |
if (result.workflow_history) {
|
| 163 |
const reportTools = ['generate_ydata_profiling_report', 'generate_plotly_dashboard', 'generate_all_plots'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 164 |
result.workflow_history.forEach((step: any) => {
|
|
|
|
| 165 |
if (reportTools.includes(step.tool)) {
|
| 166 |
-
// Check multiple possible locations for the report path
|
| 167 |
const reportPath = step.result?.output_path || step.result?.report_path || step.arguments?.output_path;
|
| 168 |
|
| 169 |
if (reportPath && (step.result?.success !== false)) {
|
|
@@ -173,6 +184,26 @@ export const ChatInterface: React.FC<{ onBack: () => void }> = ({ onBack }) => {
|
|
| 173 |
});
|
| 174 |
}
|
| 175 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 176 |
});
|
| 177 |
}
|
| 178 |
|
|
|
|
| 161 |
// Extract report paths from workflow history
|
| 162 |
if (result.workflow_history) {
|
| 163 |
const reportTools = ['generate_ydata_profiling_report', 'generate_plotly_dashboard', 'generate_all_plots'];
|
| 164 |
+
const plotTools = [
|
| 165 |
+
'generate_interactive_correlation_heatmap',
|
| 166 |
+
'generate_interactive_scatter',
|
| 167 |
+
'generate_interactive_histogram',
|
| 168 |
+
'generate_interactive_box_plots',
|
| 169 |
+
'generate_interactive_time_series',
|
| 170 |
+
'generate_eda_plots',
|
| 171 |
+
'generate_data_quality_plots',
|
| 172 |
+
'analyze_correlations'
|
| 173 |
+
];
|
| 174 |
+
|
| 175 |
result.workflow_history.forEach((step: any) => {
|
| 176 |
+
// Extract reports
|
| 177 |
if (reportTools.includes(step.tool)) {
|
|
|
|
| 178 |
const reportPath = step.result?.output_path || step.result?.report_path || step.arguments?.output_path;
|
| 179 |
|
| 180 |
if (reportPath && (step.result?.success !== false)) {
|
|
|
|
| 184 |
});
|
| 185 |
}
|
| 186 |
}
|
| 187 |
+
|
| 188 |
+
// Extract plots
|
| 189 |
+
if (plotTools.includes(step.tool)) {
|
| 190 |
+
const plotPath = step.result?.output_path || step.arguments?.output_path;
|
| 191 |
+
|
| 192 |
+
if (plotPath && (step.result?.success !== false)) {
|
| 193 |
+
const plotTitle = step.tool
|
| 194 |
+
.replace('generate_', '')
|
| 195 |
+
.replace('interactive_', '')
|
| 196 |
+
.replace(/_/g, ' ')
|
| 197 |
+
.replace('plots', 'plot')
|
| 198 |
+
.trim();
|
| 199 |
+
|
| 200 |
+
plots.push({
|
| 201 |
+
title: plotTitle.charAt(0).toUpperCase() + plotTitle.slice(1),
|
| 202 |
+
url: plotPath.replace('./outputs/', '/outputs/'),
|
| 203 |
+
type: plotPath.endsWith('.html') ? 'html' : 'image'
|
| 204 |
+
});
|
| 205 |
+
}
|
| 206 |
+
}
|
| 207 |
});
|
| 208 |
}
|
| 209 |
|