elanuk commited on
Commit
61845f6
Β·
verified Β·
1 Parent(s): 7348e8b

Update server.py

Browse files
Files changed (1) hide show
  1. server.py +25 -25
server.py CHANGED
@@ -535,36 +535,36 @@ async def run_workflow(request: WorkflowRequest):
535
 
536
  agent_responses = {}
537
 
538
- for agent_name, agent_func in agents:
539
- workflow_results.extend([agent_name, "-" * 30])
540
- try:
541
- response = agent_func(sample_alert)
542
- workflow_results.append("βœ… Message generated successfully")
543
- agent_responses[agent_name] = response
544
 
545
- # Add preview for some agents
546
- if "WhatsApp" in agent_name:
547
- text = response.get('text', 'N/A')
548
- workflow_results.append(f" Preview: {text[:100]}..." if len(text) > 100 else f" Preview: {text}")
549
- elif "SMS" in agent_name:
550
- workflow_results.append(f" Preview: {str(response)[:100]}...")
551
 
552
- except Exception as e:
553
- workflow_results.append(f"❌ Error: {str(e)}")
554
- agent_responses[agent_name] = f"Error: {str(e)}"
555
 
556
- workflow_results.append("")
557
 
558
  # Summary
559
- workflow_results.extend([
560
- "βœ… Workflow Summary",
561
- "-" * 30,
562
- f"🎯 Successfully generated alerts for {sample_alert['location']['village']}, {request.district}",
563
- f"πŸ“Š Data Sources: {sample_alert['data_source']}",
564
- f"πŸ€– AI Enhanced: {'Yes' if sample_alert['alert']['ai_generated'] else 'No'}",
565
- f"⏰ Generated at: {datetime.now().strftime('%Y-%m-%d %H:%M:%S UTC')}",
566
- f"πŸ“± Agents Processed: {len([r for r in agent_responses.values() if not str(r).startswith('Error:')])}/{len(agents)}"
567
- ])
568
 
569
  # Generate CSV
570
  csv_content = generate_csv_export(sample_alert, agent_responses)
 
535
 
536
  agent_responses = {}
537
 
538
+ # for agent_name, agent_func in agents:
539
+ # workflow_results.extend([agent_name, "-" * 30])
540
+ # try:
541
+ # response = agent_func(sample_alert)
542
+ # workflow_results.append("βœ… Message generated successfully")
543
+ # agent_responses[agent_name] = response
544
 
545
+ # # Add preview for some agents
546
+ # if "WhatsApp" in agent_name:
547
+ # text = response.get('text', 'N/A')
548
+ # workflow_results.append(f" Preview: {text[:100]}..." if len(text) > 100 else f" Preview: {text}")
549
+ # elif "SMS" in agent_name:
550
+ # workflow_results.append(f" Preview: {str(response)[:100]}...")
551
 
552
+ # except Exception as e:
553
+ # workflow_results.append(f"❌ Error: {str(e)}")
554
+ # agent_responses[agent_name] = f"Error: {str(e)}"
555
 
556
+ # workflow_results.append("")
557
 
558
  # Summary
559
+ # workflow_results.extend([
560
+ # "βœ… Workflow Summary",
561
+ # "-" * 30,
562
+ # f"🎯 Successfully generated alerts for {sample_alert['location']['village']}, {request.district}",
563
+ # f"πŸ“Š Data Sources: {sample_alert['data_source']}",
564
+ # f"πŸ€– AI Enhanced: {'Yes' if sample_alert['alert']['ai_generated'] else 'No'}",
565
+ # f"⏰ Generated at: {datetime.now().strftime('%Y-%m-%d %H:%M:%S UTC')}",
566
+ # f"πŸ“± Agents Processed: {len([r for r in agent_responses.values() if not str(r).startswith('Error:')])}/{len(agents)}"
567
+ # ])
568
 
569
  # Generate CSV
570
  csv_content = generate_csv_export(sample_alert, agent_responses)