mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
trim chat template before hashing
This commit is contained in:
@@ -257,6 +257,7 @@ router.post('/chat_template', jsonParser, async function (request, response) {
|
|||||||
if (apiType === TEXTGEN_TYPES.LLAMACPP && props['chat_template'].endsWith('\u0000')) {
|
if (apiType === TEXTGEN_TYPES.LLAMACPP && props['chat_template'].endsWith('\u0000')) {
|
||||||
props['chat_template'] = props['chat_template'].slice(0, -1);
|
props['chat_template'] = props['chat_template'].slice(0, -1);
|
||||||
}
|
}
|
||||||
|
props['chat_template'] = props['chat_template'].trim();
|
||||||
props['chat_template_hash'] = createHash('sha256').update(props['chat_template']).digest('hex');
|
props['chat_template_hash'] = createHash('sha256').update(props['chat_template']).digest('hex');
|
||||||
console.log(`We have chat template stuff: ${JSON.stringify(props)}`);
|
console.log(`We have chat template stuff: ${JSON.stringify(props)}`);
|
||||||
return response.send(props);
|
return response.send(props);
|
||||||
|
Reference in New Issue
Block a user