Spaces:
Sleeping
Sleeping
Claude commited on
Commit ยท
fe97795
1
Parent(s): e2cbbd9
Fix AC3: Force AI to generate cards in variants + add debug logging
Browse files
agents/flutter_screen_generator.py
CHANGED
|
@@ -608,91 +608,71 @@ JSON Plan:"""
|
|
| 608 |
cards_list = card_suggestions.get(app_type, card_suggestions["generic"])
|
| 609 |
cards_str = ", ".join(cards_list)
|
| 610 |
|
| 611 |
-
prompt = f"""Genera UNA home page per l'app {app_type}.
|
| 612 |
-
Crea 4 VERSIONI DIVERSE della stessa home page, ognuna con uno stile visivo differente.
|
| 613 |
|
| 614 |
-
PALETTE
|
| 615 |
- Primary: {theme_summary['primary']}
|
| 616 |
- Secondary: {theme_summary['secondary']}
|
| 617 |
- Style: {theme_summary['style']}
|
| 618 |
|
| 619 |
-
TASK: Crea 4 versioni della home page dell'app {app_type}, ognuna con:
|
| 620 |
-
- Layout diverso (grid, lista, hero card, timeline)
|
| 621 |
-
- Background diverso (scegli tra i 30 disponibili sotto)
|
| 622 |
-
- Header diverso (minimal, stats, tabs, etc)
|
| 623 |
-
- Footer diverso (floating fab, animated pills, etc)
|
| 624 |
-
- Cards diverse (3-6 cards per versione)
|
| 625 |
-
|
| 626 |
BACKGROUNDS disponibili:
|
| 627 |
{bg_list}
|
| 628 |
|
| 629 |
LAYOUTS disponibili:
|
| 630 |
-
- grid_2x2: Griglia 2 colonne
|
| 631 |
-
- vertical_list: Lista verticale
|
| 632 |
-
- hero_card: UNA card grande
|
| 633 |
-
- timeline: Timeline verticale
|
| 634 |
-
|
| 635 |
-
|
| 636 |
-
|
| 637 |
-
|
| 638 |
-
|
| 639 |
-
- tabs: Tab orizzontali
|
| 640 |
-
- stats_header: Mostra metriche chiave
|
| 641 |
-
|
| 642 |
-
FOOTERS disponibili:
|
| 643 |
-
- minimal_icons: Solo icone
|
| 644 |
-
- floating_fab: Bottone FAB centrale
|
| 645 |
-
- animated_pills: Animazioni smooth
|
| 646 |
-
- classic_expanded: Icone + etichette
|
| 647 |
-
- gesture_bar: Barra swipe iOS
|
| 648 |
-
|
| 649 |
-
CARDS per app {app_type}:
|
| 650 |
{cards_str}
|
| 651 |
|
| 652 |
-
REGOLE:
|
| 653 |
-
1.
|
| 654 |
-
2.
|
| 655 |
-
3.
|
| 656 |
-
4.
|
|
|
|
| 657 |
|
| 658 |
-
|
| 659 |
{{
|
| 660 |
"variants": [
|
| 661 |
{{
|
| 662 |
-
"name": "
|
| 663 |
-
"description": "
|
| 664 |
"layout_type": "grid_2x2",
|
| 665 |
-
"background": "
|
| 666 |
"header": "stats_header",
|
| 667 |
-
"footer": "
|
| 668 |
-
"cards": ["
|
| 669 |
"texts": {{
|
| 670 |
-
"header_title": "
|
| 671 |
-
"header_subtitle": "
|
| 672 |
-
"footer_labels": ["
|
| 673 |
-
}}
|
| 674 |
-
"reasoning": "Why this combination works"
|
| 675 |
}},
|
| 676 |
{{
|
| 677 |
-
"name": "
|
| 678 |
-
"description": "
|
| 679 |
"layout_type": "hero_card",
|
| 680 |
-
"background": "
|
| 681 |
"header": "minimal",
|
| 682 |
-
"footer": "
|
| 683 |
-
"cards": ["
|
| 684 |
"texts": {{
|
| 685 |
-
"header_title": "
|
| 686 |
-
"header_subtitle": "
|
| 687 |
-
"footer_labels": ["
|
| 688 |
-
}}
|
| 689 |
-
"reasoning": "Different background and components"
|
| 690 |
}},
|
| 691 |
-
...2 more variants with DIFFERENT layout_type, backgrounds, cards
|
| 692 |
]
|
| 693 |
}}
|
| 694 |
|
| 695 |
-
JSON:"""
|
| 696 |
|
| 697 |
try:
|
| 698 |
# Call DeepSeek API
|
|
@@ -709,6 +689,10 @@ JSON:"""
|
|
| 709 |
variants = result["variants"][:4] # Max 4
|
| 710 |
print(f"โ
AI generated {len(variants)} variants from DeepSeek")
|
| 711 |
print(f"๐ DEBUG: Variant names: {[v.get('name') for v in variants]}")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 712 |
return variants
|
| 713 |
else:
|
| 714 |
print("โ ๏ธ AI response invalid, using fallback")
|
|
|
|
| 608 |
cards_list = card_suggestions.get(app_type, card_suggestions["generic"])
|
| 609 |
cards_str = ", ".join(cards_list)
|
| 610 |
|
| 611 |
+
prompt = f"""Genera UNA home page per l'app {app_type} in 4 VERSIONI DIVERSE.
|
|
|
|
| 612 |
|
| 613 |
+
PALETTE:
|
| 614 |
- Primary: {theme_summary['primary']}
|
| 615 |
- Secondary: {theme_summary['secondary']}
|
| 616 |
- Style: {theme_summary['style']}
|
| 617 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 618 |
BACKGROUNDS disponibili:
|
| 619 |
{bg_list}
|
| 620 |
|
| 621 |
LAYOUTS disponibili:
|
| 622 |
+
- grid_2x2: Griglia 2 colonne
|
| 623 |
+
- vertical_list: Lista verticale
|
| 624 |
+
- hero_card: UNA card grande + piccole
|
| 625 |
+
- timeline: Timeline verticale
|
| 626 |
+
|
| 627 |
+
HEADERS: minimal, avatar_search, tabs, stats_header
|
| 628 |
+
FOOTERS: minimal_icons, floating_fab, animated_pills, classic_expanded, gesture_bar
|
| 629 |
+
|
| 630 |
+
CARDS OBBLIGATORIE (SCEGLI 3-6 DALLA LISTA):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 631 |
{cards_str}
|
| 632 |
|
| 633 |
+
REGOLE IMPORTANTI:
|
| 634 |
+
1. OGNI variante DEVE avere layout_type DIVERSO
|
| 635 |
+
2. OGNI variante DEVE avere background DIVERSO
|
| 636 |
+
3. OGNI variante DEVE avere 3-6 CARDS dalla lista sopra
|
| 637 |
+
4. Le cards devono essere DIVERSE per ogni variante
|
| 638 |
+
5. Personalizza i testi per {app_type}
|
| 639 |
|
| 640 |
+
ESEMPIO JSON (USA CARDS DALLA LISTA SOPRA!):
|
| 641 |
{{
|
| 642 |
"variants": [
|
| 643 |
{{
|
| 644 |
+
"name": "Dashboard Grid",
|
| 645 |
+
"description": "Grid layout for metrics",
|
| 646 |
"layout_type": "grid_2x2",
|
| 647 |
+
"background": "gradient_linear",
|
| 648 |
"header": "stats_header",
|
| 649 |
+
"footer": "minimal_icons",
|
| 650 |
+
"cards": ["workout_exercise", "step_counter", "calorie_goal", "heart_rate"],
|
| 651 |
"texts": {{
|
| 652 |
+
"header_title": "Fitness Tracker",
|
| 653 |
+
"header_subtitle": "Today's Progress",
|
| 654 |
+
"footer_labels": ["Home", "Stats", "Goals", "Profile", "More"]
|
| 655 |
+
}}
|
|
|
|
| 656 |
}},
|
| 657 |
{{
|
| 658 |
+
"name": "Hero Variant",
|
| 659 |
+
"description": "Hero card focused",
|
| 660 |
"layout_type": "hero_card",
|
| 661 |
+
"background": "waves_smooth",
|
| 662 |
"header": "minimal",
|
| 663 |
+
"footer": "floating_fab",
|
| 664 |
+
"cards": ["achievement_badge", "weight_progress", "sleep_tracker"],
|
| 665 |
"texts": {{
|
| 666 |
+
"header_title": "Your Progress",
|
| 667 |
+
"header_subtitle": "",
|
| 668 |
+
"footer_labels": ["Activity", "Stats", "Settings", "Profile", "Menu"]
|
| 669 |
+
}}
|
|
|
|
| 670 |
}},
|
| 671 |
+
...2 more variants (TOTAL 4) with DIFFERENT layout_type, backgrounds, cards
|
| 672 |
]
|
| 673 |
}}
|
| 674 |
|
| 675 |
+
Output JSON:"""
|
| 676 |
|
| 677 |
try:
|
| 678 |
# Call DeepSeek API
|
|
|
|
| 689 |
variants = result["variants"][:4] # Max 4
|
| 690 |
print(f"โ
AI generated {len(variants)} variants from DeepSeek")
|
| 691 |
print(f"๐ DEBUG: Variant names: {[v.get('name') for v in variants]}")
|
| 692 |
+
# DEBUG: Print cards for each variant
|
| 693 |
+
for v in variants:
|
| 694 |
+
cards = v.get('cards', [])
|
| 695 |
+
print(f"๐ DEBUG: Variant '{v.get('name')}' has {len(cards)} cards: {cards}")
|
| 696 |
return variants
|
| 697 |
else:
|
| 698 |
print("โ ๏ธ AI response invalid, using fallback")
|