Check for response ok

This commit is contained in:
Cohee
2024-11-23 16:01:14 +02:00
parent 50922c11fa
commit 2e661c36e5

View File

@ -1249,18 +1249,20 @@ async function getStatusTextgen() {
}),
});
const data = await response.json();
if (data) {
const { chat_template, chat_template_hash } = data;
console.log(`We have chat template ${chat_template.split('\n')[0]}...`);
const templates = await deriveTemplatesFromChatTemplate(chat_template, chat_template_hash);
if (templates) {
const { context, instruct } = templates;
if (wantsContextDerivation) {
selectContextPreset(context, { isAuto: true });
}
if (wantsInstructDerivation) {
selectInstructPreset(instruct, { isAuto: true });
if (response.ok) {
const data = await response.json();
if (data) {
const { chat_template, chat_template_hash } = data;
console.log(`We have chat template ${chat_template.split('\n')[0]}...`);
const templates = await deriveTemplatesFromChatTemplate(chat_template, chat_template_hash);
if (templates) {
const { context, instruct } = templates;
if (wantsContextDerivation) {
selectContextPreset(context, { isAuto: true });
}
if (wantsInstructDerivation) {
selectInstructPreset(instruct, { isAuto: true });
}
}
}
}