Upload stage2_graph.py
Browse files- 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 |
-
|
| 642 |
-
|
| 643 |
-
|
| 644 |
-
|
| 645 |
-
|
| 646 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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}")
|