mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-03-13 10:30:14 +01:00
Added error field check
This commit is contained in:
parent
7d568dd4e0
commit
28fc498ee6
@ -86,11 +86,11 @@ export class TextCompletionService {
|
||||
signal: new AbortController().signal,
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw await response.json();
|
||||
const json = await response.json();
|
||||
if (!response.ok || json.error) {
|
||||
throw json;
|
||||
}
|
||||
|
||||
const json = await response.json();
|
||||
return extractData ? extractMessageFromData(json, this.TYPE) : json;
|
||||
}
|
||||
|
||||
@ -156,11 +156,11 @@ export class ChatCompletionService {
|
||||
signal: new AbortController().signal,
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw await response.json();
|
||||
const json = await response.json();
|
||||
if (!response.ok || json.error) {
|
||||
throw json;
|
||||
}
|
||||
|
||||
const json = await response.json();
|
||||
return extractData ? extractMessageFromData(json, this.TYPE) : json;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user