From c7386a9737266f0e9857c7233a3590f81ec0d4f9 Mon Sep 17 00:00:00 2001 From: junghyunbak Date: Mon, 16 Dec 2024 15:43:29 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20ai=20=EA=B8=B0=EB=8A=A5=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=EB=B0=9C=EC=83=9D=20=EC=8B=9C=20=EC=98=88=EC=99=B8=20?= =?UTF-8?q?=ED=85=8D=EC=8A=A4=ED=8A=B8=20=EC=B6=9C=EB=A0=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/components/Header/AICreateButton/index.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/renderer/components/Header/AICreateButton/index.tsx b/src/renderer/components/Header/AICreateButton/index.tsx index 01df301..e7428d0 100644 --- a/src/renderer/components/Header/AICreateButton/index.tsx +++ b/src/renderer/components/Header/AICreateButton/index.tsx @@ -8,12 +8,19 @@ export function AICreateButton() { const [problem] = useStore(useShallow((s) => [s.problem])); const [setConfirm] = useStore(useShallow((s) => [s.setConfirm])); const [setCode] = useStore(useShallow((s) => [s.setCode])); + const [setMessage] = useStore(useShallow((s) => [s.setMessage])); - const { complete, completion, isLoading } = useCompletion({ + const { complete, completion, isLoading, error } = useCompletion({ api: 'https://boj-ide.junghyunbak.site/api/ai/template', experimental_throttle: 50, }); + useEffect(() => { + if (error) { + setMessage(`## ️오류 발생\n### 원인\n1. AI 서버 문제 발생\n2. AI 사용량 한도초과`); + } + }, [error, setMessage]); + useEffect(() => { setCode(completion); }, [completion, setCode]);