File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
pcweb/pages/landing/views Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -37,18 +37,22 @@ async def redirect_to_ai_builder(self, form_data: dict):
3737 random_uuid = uuid .uuid4 ()
3838
3939 async with httpx .AsyncClient () as client :
40- await client .post (
40+ response = await client .post (
4141 RX_BUILD_BACKEND .rstrip ("/" ) + "/prompt" ,
4242 json = {
43- "prompt" : prompt_map [ prompt ] ,
43+ "prompt" : prompt_map . get ( prompt , prompt ) ,
4444 "token" : str (random_uuid ),
4545 "images" : self .image_data_uris ,
4646 },
4747 )
4848 async with self :
4949 self .reset ()
50- return rx .redirect (
51- REFLEX_BUILD_URL .strip ("/" ) + f"/prompt?token={ random_uuid !s} "
50+ return (
51+ rx .redirect ("/" )
52+ if not response .is_success
53+ else rx .redirect (
54+ REFLEX_BUILD_URL .strip ("/" ) + f"/prompt?token={ random_uuid !s} "
55+ )
5256 )
5357
5458 @rx .event
You can’t perform that action at this time.
0 commit comments