From 906c8c9cc9681215766718958626c7ea1fbc9f9a Mon Sep 17 00:00:00 2001 From: Nancy <3510671794@qq.com> Date: Mon, 4 Nov 2024 20:01:03 +0800 Subject: [PATCH] feature/retry-on-export-option --- app/page.tsx | 138 +++++++++++++++++++++++++-------------------------- 1 file changed, 69 insertions(+), 69 deletions(-) diff --git a/app/page.tsx b/app/page.tsx index d0606508..de765347 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -27,87 +27,87 @@ export default function Home() { return () => { window.removeEventListener("keydown", listener); }; - }); + }, []); return ( - <> -
- - - -
- {html && - ReactDOM.createPortal( -
setHtml(null)} - > - -
, - document.body - )} - + <> +
+ + + +
+ {html && + ReactDOM.createPortal( +
setHtml(null)} + > + +
, + document.body + )} + ); } function ExportButton({ setHtml }: { setHtml: (html: string) => void }) { const editor = useEditor(); const [loading, setLoading] = useState(false); - // A tailwind styled button that is pinned to the bottom right of the screen - return ( - + const message = json.choices[0].message.content; + const start = message.indexOf(""); + const end = message.indexOf(""); + const html = message.slice(start, end + "".length); + setHtml(html); + }; + + await sendRequest(); + } finally { + setLoading(false); + } + }; + + return ( + ); }