| 1249 | }), | 1249 | }), |
| 1250 | }); | 1250 | }); |
| 1251 | | 1251 | |
| 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 | } |
| 1264 | } | 1266 | } |
| 1265 | } | 1267 | } |
| 1266 | } | 1268 | } |