mirror of
https://github.com/lmg-anon/mikupad.git
synced 2026-04-28 03:29:49 +00:00
Fix invalid selected template causing fatal errors (#135)
Some checks failed
Release Mikupad / build (push) Has been cancelled
Some checks failed
Release Mikupad / build (push) Has been cancelled
This commit is contained in:
parent
f2b5610a69
commit
7395eaee07
1 changed files with 20 additions and 1 deletions
21
mikupad.html
21
mikupad.html
|
|
@ -7128,7 +7128,12 @@ export function App({ sessionStorage, templateStorage, themeStorage, useSessionS
|
|||
}
|
||||
return text.substring(minIndex);
|
||||
}
|
||||
|
||||
|
||||
if (!template || typeof template !== 'object') {
|
||||
console.warn('Invalid or missing template object!');
|
||||
return [];
|
||||
}
|
||||
|
||||
const messages = [];
|
||||
const { sysPre, sysSuf, instPre, instSuf } = replaceNewlines(template);
|
||||
|
||||
|
|
@ -7281,6 +7286,19 @@ export function App({ sessionStorage, templateStorage, themeStorage, useSessionS
|
|||
stopParam = JSON.parse(stoppingStrings);
|
||||
}
|
||||
|
||||
if (useChatAPI && !templates[selectedTemplate]) {
|
||||
const defaultTemplate = templates["Mistral"] || Object.values(templates)[0];
|
||||
if (!defaultTemplate) {
|
||||
// this is bad...
|
||||
setChatMode(false);
|
||||
setUseChatAPI(false);
|
||||
} else {
|
||||
setSelectedTemplate(defaultTemplate);
|
||||
}
|
||||
setTriggerPredict(true);
|
||||
return;
|
||||
}
|
||||
|
||||
let startTime = 0;
|
||||
setTokensPerSec(0.0);
|
||||
|
||||
|
|
@ -9391,3 +9409,4 @@ async function main() {
|
|||
|
||||
main();
|
||||
</script>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue