From bc60b9f5c91ebc9889fbb4b2d1fc9e560d761ac8 Mon Sep 17 00:00:00 2001 From: Lars Date: Mon, 13 Apr 2026 11:27:44 +0200 Subject: [PATCH] fix: Correct indentation in SSE execute_workflow_async function --- backend/routers/prompts.py | 64 +++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/backend/routers/prompts.py b/backend/routers/prompts.py index c0c8458..734f7a2 100644 --- a/backend/routers/prompts.py +++ b/backend/routers/prompts.py @@ -1526,42 +1526,42 @@ async def execute_unified_prompt_stream( nonlocal execution_complete try: # Execute workflow with progress callbacks - result = await execute_prompt_with_data( - prompt_slug=prompt_slug, - profile_id=profile_id, - modules=modules, - timeframes=timeframes, - openrouter_call_func=workflow_llm_call, - enable_debug=debug or save, - progress_callback=progress_callback - ) + result = await execute_prompt_with_data( + prompt_slug=prompt_slug, + profile_id=profile_id, + modules=modules, + timeframes=timeframes, + openrouter_call_func=workflow_llm_call, + enable_debug=debug or save, + progress_callback=progress_callback + ) - # Save to ai_insights if requested (same logic as /execute) - if save: - if result['type'] == 'pipeline': - final_output = result.get('output', {}) - if isinstance(final_output, dict) and len(final_output) == 1: - content = list(final_output.values())[0] - else: - content = json.dumps(final_output, ensure_ascii=False) - elif result['type'] == 'workflow': - content = _workflow_user_facing_content(result.get('aggregated_result')) + # Save to ai_insights if requested (same logic as /execute) + if save: + if result['type'] == 'pipeline': + final_output = result.get('output', {}) + if isinstance(final_output, dict) and len(final_output) == 1: + content = list(final_output.values())[0] else: - content = result.get('output', '') - if isinstance(content, dict): - content = json.dumps(content, ensure_ascii=False) + content = json.dumps(final_output, ensure_ascii=False) + elif result['type'] == 'workflow': + content = _workflow_user_facing_content(result.get('aggregated_result')) + else: + content = result.get('output', '') + if isinstance(content, dict): + content = json.dumps(content, ensure_ascii=False) - # Save to database (minimal metadata for now) - with get_db() as conn: - cur = get_cursor(conn) - cur.execute( - """INSERT INTO ai_insights (profile_id, scope, content, metadata, created_at) - VALUES (%s, %s, %s, %s, NOW())""", - (profile_id, prompt_slug, content, json.dumps({"prompt_type": result['type']})) - ) - conn.commit() + # Save to database (minimal metadata for now) + with get_db() as conn: + cur = get_cursor(conn) + cur.execute( + """INSERT INTO ai_insights (profile_id, scope, content, metadata, created_at) + VALUES (%s, %s, %s, %s, NOW())""", + (profile_id, prompt_slug, content, json.dumps({"prompt_type": result['type']})) + ) + conn.commit() - except Exception as e: + except Exception as e: # Queue error event await event_queue.put({ "type": "execution_failed",