1515MAX_FILE_SIZE_MB = 5
1616MAX_FILE_SIZE_BYTES = MAX_FILE_SIZE_MB * 1024 * 1024
1717MAX_IMAGES_COUNT = 5
18+ prompt_map = {
19+ "Use an Image" : "Build an app from a reference image" ,
20+ "Chat App" : "A chat app hooked up to an LLM" ,
21+ "Landing Page" : "SaaS Landing Page for an AI Company" ,
22+ }
1823
1924
2025class ImageData (TypedDict ):
@@ -35,12 +40,13 @@ async def redirect_to_ai_builder(self, form_data: dict):
3540 await client .post (
3641 RX_BUILD_BACKEND .rstrip ("/" ) + "/prompt" ,
3742 json = {
38- "prompt" : prompt ,
43+ "prompt" : prompt_map [ prompt ] ,
3944 "token" : str (random_uuid ),
4045 "images" : self .image_data_uris ,
4146 },
4247 )
43-
48+ async with self :
49+ self .reset ()
4450 return rx .redirect (
4551 REFLEX_BUILD_URL .strip ("/" ) + f"/prompt?token={ random_uuid !s} "
4652 )
@@ -378,7 +384,7 @@ def prompt_box() -> rx.Component:
378384 rx .box (
379385 preset_image_card (text = "Use an Image" , id = "upload-image-button" ),
380386 preset_cards (text = "Chat App" , id = "chat-app" , icon = "ai-chat-02" ),
381- preset_cards (text = "Dashboard UI " , id = "dashboard-ui " , icon = "webpage" ),
387+ preset_cards (text = "Landing Page " , id = "landing-page " , icon = "webpage" ),
382388 class_name = "grid grid-cols-1 lg:grid-cols-3 gap-2" ,
383389 ),
384390 class_name = "flex flex-col gap-4 w-full" ,
0 commit comments