mirror of
https://github.com/NovaOSS/nova-betterchat.git
synced 2024-11-25 21:43:59 +01:00
parent
6a3a154501
commit
8fcf0764e5
|
@ -44,13 +44,15 @@ export const getChatCompletionStream = async (
|
||||||
'Message from freechatgpt.chat:\nInvalid API endpoint! We recommend you to check your free API endpoint.'
|
'Message from freechatgpt.chat:\nInvalid API endpoint! We recommend you to check your free API endpoint.'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (response.status === 429 || !response.ok) {
|
||||||
const text = await response.text();
|
const text = await response.text();
|
||||||
if (response.status === 429 && text.includes('insufficient_quota'))
|
let error = text;
|
||||||
throw new Error(
|
if (text.includes('insufficient_quota')) {
|
||||||
text +
|
error +=
|
||||||
'\nMessage from freechatgpt.chat:\nWe recommend changing your API endpoint or API key'
|
'\nMessage from freechatgpt.chat:\nWe recommend changing your API endpoint or API key';
|
||||||
);
|
}
|
||||||
if (!response.ok) throw new Error(text);
|
throw new Error(error);
|
||||||
|
}
|
||||||
|
|
||||||
const stream = response.body;
|
const stream = response.body;
|
||||||
return stream;
|
return stream;
|
||||||
|
|
Loading…
Reference in a new issue