Check for response ok

2e661c36e5067de68bd6fd8b470c27a8e35c2264

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +14 -12Ignore whitespace
public/script.js+14 -12
@@ -1249,18 +1249,20 @@ async function getStatusTextgen() {
12491249 }),
12501250 });
12511251
1252- const data = await response.json();
1252+ if (response.ok) {
1253- if (data) {
1253+ const data = await response.json();
1254- const { chat_template, chat_template_hash } = data;
1254+ if (data) {
1255- console.log(`We have chat template ${chat_template.split('\n')[0]}...`);
1255+ const { chat_template, chat_template_hash } = data;
1256- const templates = await deriveTemplatesFromChatTemplate(chat_template, chat_template_hash);
1256+ console.log(`We have chat template ${chat_template.split('\n')[0]}...`);
1257- if (templates) {
1257+ const templates = await deriveTemplatesFromChatTemplate(chat_template, chat_template_hash);
1258- const { context, instruct } = templates;
1258+ if (templates) {
1259- if (wantsContextDerivation) {
1259+ const { context, instruct } = templates;
1260- selectContextPreset(context, { isAuto: true });
1260+ if (wantsContextDerivation) {
1261- }
1261+ selectContextPreset(context, { isAuto: true });
1262- if (wantsInstructDerivation) {
1262+ }
1263- selectInstructPreset(instruct, { isAuto: true });
1263+ if (wantsInstructDerivation) {
1264+ selectInstructPreset(instruct, { isAuto: true });
1265+ }
12641266 }
12651267 }
12661268 }