From eec20dab9514a1ad34368d7954dbacc5812f84d6 Mon Sep 17 00:00:00 2001 From: Karl-Johan Alm Date: Mon, 25 Nov 2024 15:36:46 +0900 Subject: [PATCH] template derivation: explicitly skip derivation attempt if chat_template is empty --- public/scripts/chat-templates.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/public/scripts/chat-templates.js b/public/scripts/chat-templates.js index 5fcdf6123..ee73bc3e9 100644 --- a/public/scripts/chat-templates.js +++ b/public/scripts/chat-templates.js @@ -65,6 +65,11 @@ const parse_derivation = derivation => (typeof derivation === 'string') ? { } : derivation; export async function deriveTemplatesFromChatTemplate(chat_template, hash) { + if (chat_template.trim() === '') { + console.log('Missing chat template.'); + return null; + } + if (hash in hash_derivations) { return parse_derivation(hash_derivations[hash]); }