From 542f77aeb819fced598c54e2c581460dee3906b1 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Mon, 28 Oct 2024 11:39:59 +0000 Subject: [PATCH] Safe sequence breakers parse --- public/scripts/textgen-settings.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/scripts/textgen-settings.js b/public/scripts/textgen-settings.js index 978256f6f..eec2f96b2 100644 --- a/public/scripts/textgen-settings.js +++ b/public/scripts/textgen-settings.js @@ -1307,12 +1307,13 @@ export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate, : []; const tokenBans = toIntArray(banned_tokens); logitBiasArray.push(...tokenBans.map(x => [Number(x), false])); + const sequenceBreakers = (() => { try { return JSON.parse(params.dry_sequence_breakers); } catch { return undefined; } })(); const llamaCppParams = { 'logit_bias': logitBiasArray, // Conflicts with ooba's grammar_string 'grammar': settings.grammar_string, 'cache_prompt': true, - 'dry_sequence_breakers': JSON.parse(params.dry_sequence_breakers), + 'dry_sequence_breakers': sequenceBreakers, }; params = Object.assign(params, llamaCppParams); }