diff --git a/public/script.js b/public/script.js index ced5f614e..958120ef1 100644 --- a/public/script.js +++ b/public/script.js @@ -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 }); + } } } }