Update server.py
Browse files
server.py
CHANGED
@@ -822,7 +822,7 @@ BIHAR_DISTRICTS = [
|
|
822 |
]
|
823 |
|
824 |
def format_workflow_output(raw_output, agent_responses=None):
|
825 |
-
"""Format workflow output for display
|
826 |
if not raw_output:
|
827 |
return "β No output received"
|
828 |
|
@@ -889,19 +889,10 @@ async def run_workflow_clean(request: WorkflowRequest):
|
|
889 |
except Exception as e:
|
890 |
agent_responses[agent_name] = f"Error: {str(e)}"
|
891 |
|
892 |
-
summary_message = f"""### β
Workflow Summary
|
893 |
-
|
894 |
-
π― Successfully generated alerts for {sample_alert['location']['village']}, {request.district.title()}
|
895 |
-
π Data Sources: {sample_alert['data_source']}
|
896 |
-
π€ AI Enhanced: {'Yes' if sample_alert['alert']['ai_generated'] else 'No'}
|
897 |
-
β° Generated at: {datetime.now().strftime('%Y-%m-%d %H:%M:%S UTC')}
|
898 |
-
π± Agents Processed: {successful_agents}/{len(agents)}"""
|
899 |
-
|
900 |
# Generate CSV
|
901 |
csv_content = generate_csv_export(sample_alert, agent_responses)
|
902 |
|
903 |
return {
|
904 |
-
"message": summary_message,
|
905 |
"status": "success",
|
906 |
"csv": csv_content,
|
907 |
"raw_data": {
|
@@ -1023,7 +1014,6 @@ def run_workflow_ui(district):
|
|
1023 |
raw_data = result.get('raw_data', {})
|
1024 |
agent_responses = raw_data.get('agent_responses', {})
|
1025 |
|
1026 |
-
workflow_output = result.get('message', '')
|
1027 |
alert_summary = format_alert_summary(raw_data)
|
1028 |
agent_details = format_agent_responses(agent_responses)
|
1029 |
csv_content = result.get('csv', '')
|
|
|
822 |
]
|
823 |
|
824 |
def format_workflow_output(raw_output, agent_responses=None):
|
825 |
+
"""Format workflow output for display"""
|
826 |
if not raw_output:
|
827 |
return "β No output received"
|
828 |
|
|
|
889 |
except Exception as e:
|
890 |
agent_responses[agent_name] = f"Error: {str(e)}"
|
891 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
892 |
# Generate CSV
|
893 |
csv_content = generate_csv_export(sample_alert, agent_responses)
|
894 |
|
895 |
return {
|
|
|
896 |
"status": "success",
|
897 |
"csv": csv_content,
|
898 |
"raw_data": {
|
|
|
1014 |
raw_data = result.get('raw_data', {})
|
1015 |
agent_responses = raw_data.get('agent_responses', {})
|
1016 |
|
|
|
1017 |
alert_summary = format_alert_summary(raw_data)
|
1018 |
agent_details = format_agent_responses(agent_responses)
|
1019 |
csv_content = result.get('csv', '')
|