Skip to content

Commit

Permalink
feat: ai 기능 에러발생 시 예외 텍스트 출력
Browse files Browse the repository at this point in the history
  • Loading branch information
junghyunbak committed Dec 16, 2024
1 parent a2b4914 commit c7386a9
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/renderer/components/Header/AICreateButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down

0 comments on commit c7386a9

Please sign in to comment.