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 (response.ok) {
if (data) { const data = await response.json();
const { chat_template, chat_template_hash } = data; if (data) {
console.log(`We have chat template ${chat_template.split('\n')[0]}...`); const { chat_template, chat_template_hash } = data;
const templates = await deriveTemplatesFromChatTemplate(chat_template, chat_template_hash); console.log(`We have chat template ${chat_template.split('\n')[0]}...`);
if (templates) { const templates = await deriveTemplatesFromChatTemplate(chat_template, chat_template_hash);
const { context, instruct } = templates; if (templates) {
if (wantsContextDerivation) { const { context, instruct } = templates;
selectContextPreset(context, { isAuto: true }); if (wantsContextDerivation) {
} selectContextPreset(context, { isAuto: true });
if (wantsInstructDerivation) { }
selectInstructPreset(instruct, { isAuto: true }); if (wantsInstructDerivation) {
selectInstructPreset(instruct, { isAuto: true });
}
} }
} }
} }