riazmo commited on
Commit
5857f75
Β·
verified Β·
1 Parent(s): a2bd6e4

Upload stage2_graph.py

Browse files
Files changed (1) hide show
  1. agents/stage2_graph.py +62 -8
agents/stage2_graph.py CHANGED
@@ -633,17 +633,56 @@ async def compile_with_head(state: Stage2State, log_callback: Optional[Callable]
633
  resolution = d.get("resolution", "")[:60]
634
  log_callback(f" β”œβ”€ {topic}: {resolution}...")
635
 
636
- # Final recommendations
637
  final_recs = recommendations.get("final_recommendations", {})
638
  if final_recs:
639
  log_callback("")
640
- log_callback(" πŸ“‹ FINAL RECOMMENDATIONS:")
641
- log_callback(f" β”œβ”€ Type Scale: {final_recs.get('type_scale', '?')}")
642
- log_callback(f" β”œβ”€ Spacing: {final_recs.get('spacing_base', '?')}")
643
- if final_recs.get("color_improvements"):
644
- log_callback(f" β”œβ”€ Colors: {final_recs['color_improvements'][0][:50]}...")
645
- if final_recs.get("accessibility_fixes"):
646
- log_callback(f" └─ AA Fixes: {final_recs['accessibility_fixes'][0][:50]}...")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
647
 
648
  # Summary
649
  if recommendations.get("summary"):
@@ -656,6 +695,21 @@ async def compile_with_head(state: Stage2State, log_callback: Optional[Callable]
656
  log_callback(f" 🎯 OVERALL CONFIDENCE: {recommendations.get('overall_confidence', '?')}%")
657
 
658
  if log_callback:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
659
  log_callback("")
660
  log_callback("=" * 60)
661
  log_callback(f"πŸ’° TOTAL ESTIMATED COST: ${cost_tracker.total_cost:.4f}")
 
633
  resolution = d.get("resolution", "")[:60]
634
  log_callback(f" β”œβ”€ {topic}: {resolution}...")
635
 
636
+ # Final recommendations with IMPACT
637
  final_recs = recommendations.get("final_recommendations", {})
638
  if final_recs:
639
  log_callback("")
640
+ log_callback(" πŸ“‹ FINAL RECOMMENDATIONS (APPLIED):")
641
+
642
+ # Type Scale with impact
643
+ type_scale = final_recs.get('type_scale', '1.25')
644
+ log_callback(f" β”œβ”€ Type Scale: {type_scale}")
645
+ log_callback(f" β”‚ └─ βœ… IMPACT: All typography sizes will use {type_scale} ratio")
646
+
647
+ # Spacing with impact
648
+ spacing = final_recs.get('spacing_base', '8px')
649
+ log_callback(f" β”œβ”€ Spacing: {spacing}")
650
+ log_callback(f" β”‚ └─ βœ… IMPACT: Spacing scale: 0, 8, 16, 24, 32, 40, 48...")
651
+
652
+ # Color recommendations with impact
653
+ color_recs = final_recs.get("color_recommendations", {})
654
+ if color_recs:
655
+ log_callback(f" β”œβ”€ Color Recommendations:")
656
+ for role, rec in list(color_recs.items())[:4]:
657
+ if isinstance(rec, dict):
658
+ current = rec.get("current", "?")
659
+ action = rec.get("action", "keep")
660
+ suggested = rec.get("suggested", current)
661
+ if action != "keep" and suggested != current:
662
+ log_callback(f" β”‚ β”œβ”€ {role}: {current} β†’ {suggested}")
663
+ log_callback(f" β”‚ β”‚ └─ βœ… IMPACT: Color will be changed")
664
+ else:
665
+ log_callback(f" β”‚ β”œβ”€ {role}: {current} (keep)")
666
+
667
+ # Accessibility fixes with impact
668
+ aa_fixes = final_recs.get("accessibility_fixes", [])
669
+ if aa_fixes:
670
+ log_callback(f" β”œβ”€ Accessibility Fixes:")
671
+ for fix in aa_fixes[:3]:
672
+ if isinstance(fix, dict):
673
+ color = fix.get("color", "?")
674
+ issue = fix.get("issue", "contrast issue")
675
+ fix_color = fix.get("fix", "?")
676
+ log_callback(f" β”‚ β”œβ”€ {color}: {issue}")
677
+ log_callback(f" β”‚ β”‚ └─ βœ… IMPACT: Suggest {fix_color} for AA compliance")
678
+ else:
679
+ log_callback(f" β”‚ β”œβ”€ {str(fix)[:50]}...")
680
+
681
+ # Generate ramps for
682
+ ramps_for = final_recs.get("generate_ramps_for", [])
683
+ if ramps_for:
684
+ log_callback(f" └─ Generate Ramps For: {', '.join(ramps_for[:5])}")
685
+ log_callback(f" └─ βœ… IMPACT: Full 50-950 ramps will be created")
686
 
687
  # Summary
688
  if recommendations.get("summary"):
 
695
  log_callback(f" 🎯 OVERALL CONFIDENCE: {recommendations.get('overall_confidence', '?')}%")
696
 
697
  if log_callback:
698
+ log_callback("")
699
+ log_callback("=" * 60)
700
+ log_callback("πŸ“Š LLM IMPACT SUMMARY")
701
+ log_callback("=" * 60)
702
+ log_callback("")
703
+ log_callback(" WHAT LLMs ANALYZED:")
704
+ log_callback(" β”œβ”€ Typography: Scale ratio, hierarchy, base size")
705
+ log_callback(" β”œβ”€ Colors: Brand consistency, semantic roles, contrast")
706
+ log_callback(" β”œβ”€ Accessibility: WCAG AA compliance per color")
707
+ log_callback(" └─ Spacing: Grid alignment, consistency")
708
+ log_callback("")
709
+ log_callback(" WHAT CHANGED (LLM β†’ Rule Engine):")
710
+ log_callback(f" β”œβ”€ Type Scale: Rule default 1.25 β†’ LLM confirmed/adjusted")
711
+ log_callback(f" β”œβ”€ Spacing: Rule default 8px β†’ LLM confirmed")
712
+ log_callback(f" └─ Colors: Ramps generated with LLM AA suggestions")
713
  log_callback("")
714
  log_callback("=" * 60)
715
  log_callback(f"πŸ’° TOTAL ESTIMATED COST: ${cost_tracker.total_cost:.4f}")