template derivation: explicitly skip derivation attempt if chat_template is empty

eec20dab9514a1ad34368d7954dbacc5812f84d6

Karl-Johan Alm <karljohan-alm@garage.co.jp>

Signed
1 files changed, +5 -0Showing whitespace changes
public/scripts/chat-templates.js+5 -0
@@ -65,6 +65,11 @@ const parse_derivation = derivation => (typeof derivation === 'string') ? {
65} : derivation;65} : derivation;
6666
67export async function deriveTemplatesFromChatTemplate(chat_template, hash) {67export async function deriveTemplatesFromChatTemplate(chat_template, hash) {
68 if (chat_template.trim() === '') {
69 console.log('Missing chat template.');
70 return null;
71 }
72
68 if (hash in hash_derivations) {73 if (hash in hash_derivations) {
69 return parse_derivation(hash_derivations[hash]);74 return parse_derivation(hash_derivations[hash]);
70 }75 }