diff --git a/src/api/freeApi.ts b/src/api/freeApi.ts index 67dbf15..bb372ac 100644 --- a/src/api/freeApi.ts +++ b/src/api/freeApi.ts @@ -39,7 +39,13 @@ export const getChatCompletionStream = async ( stream: true, }), }); - if (!response.ok) throw new Error(await response.text()); + const text = await response.text(); + if (response.status === 429 && text.includes('insufficient_quota')) + throw new Error( + text + + '\nMessage from freechatgpt.chat:\nWe recommend changing your API endpoint or API key' + ); + if (!response.ok) throw new Error(text); const stream = response.body; return stream; diff --git a/src/components/Chat/ChatContent/ChatContent.tsx b/src/components/Chat/ChatContent/ChatContent.tsx index 4c7a398..9b091fc 100644 --- a/src/components/Chat/ChatContent/ChatContent.tsx +++ b/src/components/Chat/ChatContent/ChatContent.tsx @@ -60,8 +60,8 @@ const ChatContent = () => { /> {error !== '' && ( -