Fix streaming processor error handler hooks

This commit is contained in:
Cohee
2023-12-08 02:01:08 +02:00
parent 055d6c4337
commit b0e7b73a32
6 changed files with 42 additions and 25 deletions

View File

@ -1123,7 +1123,7 @@ function tryParseStreamingError(response, decoded) {
checkQuotaError(data);
if (data.error) {
toastr.error(data.error.message || response.statusText, 'API returned an error');
toastr.error(data.error.message || response.statusText, 'Chat Completion API');
throw new Error(data);
}
}
@ -1564,7 +1564,7 @@ async function sendOpenAIRequest(type, messages, signal) {
});
if (!response.ok) {
tryParseStreamingError(response, await response.body.text());
tryParseStreamingError(response, await response.text());
throw new Error(`Got response status ${response.status}`);
}