diff --git a/frontend/src/components/workflow/panels/WorkflowExecutePanel.jsx b/frontend/src/components/workflow/panels/WorkflowExecutePanel.jsx index 24096a4..ffd9d15 100644 --- a/frontend/src/components/workflow/panels/WorkflowExecutePanel.jsx +++ b/frontend/src/components/workflow/panels/WorkflowExecutePanel.jsx @@ -6,11 +6,10 @@ import { api } from '../../../utils/api' * * Features: * - Execute Button mit Loading State + * - SSE Streaming (kein Timeout bei langen Workflows) + * - Real-time Progress * - Error Handling - * - Success State * - Debug Mode Toggle - * - * Part 2: Frontend Execute Integration */ export function WorkflowExecutePanel({ currentPrompt, @@ -20,6 +19,7 @@ export function WorkflowExecutePanel({ const [executing, setExecuting] = useState(false) const [error, setError] = useState(null) const [debugMode, setDebugMode] = useState(true) + const [progress, setProgress] = useState(null) const handleExecute = async () => { if (!currentPrompt || !currentPrompt.slug) { @@ -30,14 +30,28 @@ export function WorkflowExecutePanel({ try { setExecuting(true) setError(null) + setProgress({ current: 0, total: 0, label: 'Starte...' }) - console.log('🚀 Executing workflow:', currentPrompt.slug) + console.log('🚀 Executing workflow via SSE:', currentPrompt.slug) - const result = await api.executeWorkflow( + const result = await api.executeUnifiedPromptStream( currentPrompt.slug, - null, // variables (später erweiterbar) + null, // modules + null, // timeframes debugMode, - false // save (nicht in ai_insights speichern) + false, // save (nicht in ai_insights speichern) + (event) => { + // Progress callback für real-time updates + if (event.type === 'execution_started') { + setProgress({ current: 0, total: 0, label: 'Gestartet...' }) + } else if (event.type === 'node_complete') { + setProgress({ + current: event.completed_nodes || 0, + total: event.total_nodes || 0, + label: event.node_label || 'Processing...' + }) + } + } ) console.log('✅ Workflow execution completed:', result) @@ -57,81 +71,107 @@ export function WorkflowExecutePanel({ setError(e.message) } finally { setExecuting(false) + setProgress(null) } } return ( -
- {/* Debug Mode Toggle */} -