From 00f0f755fc82d0535e3754e9a728a559cb27a808 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Mon, 28 Oct 2024 11:44:26 +0000 Subject: [PATCH] Support comma-separated list of llama.cpp sequence breakers #3026 --- public/scripts/textgen-settings.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/public/scripts/textgen-settings.js b/public/scripts/textgen-settings.js index eec2f96b2..4bc61ace5 100644 --- a/public/scripts/textgen-settings.js +++ b/public/scripts/textgen-settings.js @@ -1307,7 +1307,17 @@ 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 sequenceBreakers = (() => { + try { + return JSON.parse(params.dry_sequence_breakers); + } catch { + if (typeof params.dry_sequence_breakers === 'string') { + return params.dry_sequence_breakers.split(','); + } + + return undefined; + } + })(); const llamaCppParams = { 'logit_bias': logitBiasArray, // Conflicts with ooba's grammar_string