Extract data.error check

This commit is contained in:
valadaptive 2023-12-26 12:41:35 -05:00
parent 0f8a16325b
commit 77b02a8d4b
1 changed files with 88 additions and 88 deletions

View File

@ -3861,7 +3861,15 @@ async function Generate(type, { automatic_trigger, force_name2, quiet_prompt, qu
if (!data) return;
let messageChunk = '';
if (!data.error) {
if (data.error) {
generatedPromptCache = '';
if (data?.response) {
toastr.error(data.response, 'API Error');
}
throw data?.response;
}
//const getData = await response.json();
let getMessage = extractMessageFromData(data);
let title = extractTitleFromData(data);
@ -3948,14 +3956,6 @@ async function Generate(type, { automatic_trigger, force_name2, quiet_prompt, qu
return;
}
}
} else {
generatedPromptCache = '';
if (data?.response) {
toastr.error(data.response, 'API Error');
}
throw data?.response;
}
console.debug('/api/chats/save called by /Generate');
await saveChatConditional();