Spaces:
Sleeping
Sleeping
Claude commited on
Commit ·
6dff68d
1
Parent(s): a740077
Improve custom prompt usage: AI now generates based on user task description
Browse files
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 |
-
|
|
|
|
|
|
|
| 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
|
| 634 |
-
|
| 635 |
-
|
| 636 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 637 |
{cards_str}
|
| 638 |
|
| 639 |
-
REGOLE
|
| 640 |
-
1.
|
| 641 |
-
2.
|
| 642 |
-
3.
|
| 643 |
4. Le cards devono essere DIVERSE per ogni variante
|
| 644 |
-
5.
|
| 645 |
|
| 646 |
-
ESEMPIO JSON (USA CARDS DALLA LISTA SOPRA!):
|
| 647 |
{{
|
| 648 |
"variants": [
|
| 649 |
{{
|
| 650 |
-
"name": "
|
| 651 |
-
"description": "
|
| 652 |
"layout_type": "grid_2x2",
|
| 653 |
"background": "gradient_linear",
|
| 654 |
"header": "stats_header",
|
| 655 |
"footer": "minimal_icons",
|
| 656 |
-
"cards": ["
|
| 657 |
"texts": {{
|
| 658 |
-
"header_title": "
|
| 659 |
-
"header_subtitle": "
|
| 660 |
-
"footer_labels": ["
|
| 661 |
}}
|
| 662 |
}},
|
| 663 |
{{
|
| 664 |
-
"name": "
|
| 665 |
-
"description": "
|
| 666 |
"layout_type": "hero_card",
|
| 667 |
"background": "waves_smooth",
|
| 668 |
"header": "minimal",
|
| 669 |
"footer": "floating_fab",
|
| 670 |
-
"cards": ["
|
| 671 |
"texts": {{
|
| 672 |
-
"header_title": "
|
| 673 |
"header_subtitle": "",
|
| 674 |
-
"footer_labels": ["
|
| 675 |
}}
|
| 676 |
}},
|
| 677 |
-
...2 more variants (TOTAL 4)
|
| 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 |
|