Claude commited on
Commit
6dff68d
·
1 Parent(s): a740077

Improve custom prompt usage: AI now generates based on user task description

Browse files
Files changed (1) hide show
  1. agents/flutter_screen_generator.py +43 -32
agents/flutter_screen_generator.py CHANGED
@@ -613,68 +613,79 @@ JSON Plan:"""
613
  task_description = custom_prompt if custom_prompt.strip() else f"Genera UNA home page per l'app {app_type}"
614
  print(f"📝 Using prompt: {task_description}")
615
 
616
- prompt = f"""{task_description}
617
- Crea 4 VERSIONI DIVERSE della schermata richiesta.
618
 
619
- PALETTE:
 
 
620
  - Primary: {theme_summary['primary']}
621
  - Secondary: {theme_summary['secondary']}
622
  - Style: {theme_summary['style']}
623
 
624
- BACKGROUNDS disponibili:
625
  {bg_list}
626
 
627
- LAYOUTS disponibili:
628
- - grid_2x2: Griglia 2 colonne
629
- - vertical_list: Lista verticale
630
- - hero_card: UNA card grande + piccole
631
- - timeline: Timeline verticale
632
-
633
- HEADERS: minimal, avatar_search, tabs, stats_header
634
- FOOTERS: minimal_icons, floating_fab, animated_pills, classic_expanded, gesture_bar
635
-
636
- CARDS OBBLIGATORIE (SCEGLI 3-6 DALLA LISTA):
 
 
 
 
 
 
 
 
 
 
637
  {cards_str}
638
 
639
- REGOLE IMPORTANTI:
640
- 1. OGNI variante DEVE avere layout_type DIVERSO
641
- 2. OGNI variante DEVE avere background DIVERSO
642
- 3. OGNI variante DEVE avere 3-6 CARDS dalla lista sopra
643
  4. Le cards devono essere DIVERSE per ogni variante
644
- 5. Personalizza i testi per {app_type}
645
 
646
- ESEMPIO JSON (USA CARDS DALLA LISTA SOPRA!):
647
  {{
648
  "variants": [
649
  {{
650
- "name": "Dashboard Grid",
651
- "description": "Grid layout for metrics",
652
  "layout_type": "grid_2x2",
653
  "background": "gradient_linear",
654
  "header": "stats_header",
655
  "footer": "minimal_icons",
656
- "cards": ["workout_exercise", "step_counter", "calorie_goal", "heart_rate"],
657
  "texts": {{
658
- "header_title": "Fitness Tracker",
659
- "header_subtitle": "Today's Progress",
660
- "footer_labels": ["Home", "Stats", "Goals", "Profile", "More"]
661
  }}
662
  }},
663
  {{
664
- "name": "Hero Variant",
665
- "description": "Hero card focused",
666
  "layout_type": "hero_card",
667
  "background": "waves_smooth",
668
  "header": "minimal",
669
  "footer": "floating_fab",
670
- "cards": ["achievement_badge", "weight_progress", "sleep_tracker"],
671
  "texts": {{
672
- "header_title": "Your Progress",
673
  "header_subtitle": "",
674
- "footer_labels": ["Activity", "Stats", "Settings", "Profile", "Menu"]
675
  }}
676
  }},
677
- ...2 more variants (TOTAL 4) with DIFFERENT layout_type, backgrounds, cards
678
  ]
679
  }}
680
 
 
613
  task_description = custom_prompt if custom_prompt.strip() else f"Genera UNA home page per l'app {app_type}"
614
  print(f"📝 Using prompt: {task_description}")
615
 
616
+ prompt = f"""TASK: {task_description}
 
617
 
618
+ Genera 4 VERSIONI DIVERSE usando questi componenti:
619
+
620
+ PALETTE COLORI:
621
  - Primary: {theme_summary['primary']}
622
  - Secondary: {theme_summary['secondary']}
623
  - Style: {theme_summary['style']}
624
 
625
+ BACKGROUNDS disponibili (scegli 4 diversi):
626
  {bg_list}
627
 
628
+ LAYOUTS disponibili (ogni variante DEVE usare un layout DIVERSO):
629
+ - grid_2x2: Griglia 2 colonne per metriche/dashboard
630
+ - vertical_list: Lista verticale scrollabile classica
631
+ - hero_card: UNA card grande in alto + 2-3 card piccole sotto
632
+ - timeline: Timeline verticale per eventi cronologici
633
+
634
+ HEADERS disponibili:
635
+ - minimal: Solo titolo pulito
636
+ - avatar_search: Avatar + barra ricerca (social apps)
637
+ - tabs: Tab orizzontali per navigazione
638
+ - stats_header: Mostra metriche chiave (fitness/finance apps)
639
+
640
+ FOOTERS disponibili:
641
+ - minimal_icons: Solo icone, nessuna label
642
+ - floating_fab: Bottone FAB centrale galleggiante
643
+ - animated_pills: Pill animate con transizioni smooth
644
+ - classic_expanded: Icone + etichette classiche
645
+ - gesture_bar: Barra gesture iOS-style
646
+
647
+ CARDS DISPONIBILI (SCEGLI 3-6 PER OGNI VARIANTE):
648
  {cards_str}
649
 
650
+ REGOLE OBBLIGATORIE:
651
+ 1. Ogni variante DEVE avere layout_type DIVERSO (grid_2x2, vertical_list, hero_card, timeline)
652
+ 2. Ogni variante DEVE avere background DIVERSO
653
+ 3. Ogni variante DEVE avere 3-6 CARDS dalla lista sopra
654
  4. Le cards devono essere DIVERSE per ogni variante
655
+ 5. I testi (header_title, header_subtitle) devono essere COERENTI con il TASK richiesto
656
 
657
+ ESEMPIO STRUTTURA JSON (USA CARDS DALLA LISTA SOPRA E TESTI COERENTI CON IL TASK!):
658
  {{
659
  "variants": [
660
  {{
661
+ "name": "Nome Descrittivo Variante 1",
662
+ "description": "Breve descrizione",
663
  "layout_type": "grid_2x2",
664
  "background": "gradient_linear",
665
  "header": "stats_header",
666
  "footer": "minimal_icons",
667
+ "cards": ["card1", "card2", "card3", "card4"],
668
  "texts": {{
669
+ "header_title": "Titolo COERENTE con il TASK",
670
+ "header_subtitle": "Sottotitolo opzionale",
671
+ "footer_labels": ["Tab1", "Tab2", "Tab3", "Tab4", "Tab5"]
672
  }}
673
  }},
674
  {{
675
+ "name": "Nome Descrittivo Variante 2",
676
+ "description": "Approccio diverso",
677
  "layout_type": "hero_card",
678
  "background": "waves_smooth",
679
  "header": "minimal",
680
  "footer": "floating_fab",
681
+ "cards": ["card5", "card6", "card7"],
682
  "texts": {{
683
+ "header_title": "Titolo DIVERSO ma COERENTE",
684
  "header_subtitle": "",
685
+ "footer_labels": ["Home", "Explore", "Profile", "Settings", "More"]
686
  }}
687
  }},
688
+ ...2 more variants (TOTAL 4) con layout_type, backgrounds e cards DIVERSI
689
  ]
690
  }}
691