From 6e6bb47718640ee9d82f377c37bd9506b4352837 Mon Sep 17 00:00:00 2001 From: GanstaKingofSA Date: Mon, 4 Sep 2023 16:26:43 -0500 Subject: [PATCH 1/2] implement input sequence as a stop sequence by default --- public/script.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/public/script.js b/public/script.js index c39fc9621..402230396 100644 --- a/public/script.js +++ b/public/script.js @@ -3800,6 +3800,13 @@ function cleanUpMessage(getMessage, isImpersonate, isContinue, displayIncomplete getMessage = getMessage.substring(0, getMessage.indexOf(power_user.instruct.stop_sequence)); } } + // Hana: Only use the first sequence (should be <|model|>) + // of the prompt before <|user|> (as KoboldAI Lite does it). + if (isInstruct && power_user.instruct.input_sequence) { + if (getMessage.indexOf(power_user.instruct.input_sequence) != -1) { + getMessage = getMessage.substring(0, getMessage.indexOf(power_user.instruct.input_sequence)); + } + } if (isInstruct && power_user.instruct.input_sequence && isImpersonate) { //getMessage = getMessage.replaceAll(power_user.instruct.input_sequence, ''); power_user.instruct.input_sequence.split('\n') From fe64597a237cb114bcb456da618e4aa9f8eb56e8 Mon Sep 17 00:00:00 2001 From: Bahamut Date: Tue, 5 Sep 2023 23:30:58 +0300 Subject: [PATCH 2/2] LibreTranslate URL Example --- public/scripts/extensions/translate/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/public/scripts/extensions/translate/index.js b/public/scripts/extensions/translate/index.js index 2be6cf45f..488ab2071 100644 --- a/public/scripts/extensions/translate/index.js +++ b/public/scripts/extensions/translate/index.js @@ -199,7 +199,6 @@ async function translateProviderLibre(text, lang) { throw new Error(response.statusText); } - async function translateProviderGoogle(text, lang) { const response = await fetch('/google_translate', { method: 'POST', @@ -447,7 +446,9 @@ jQuery(() => { }); $('#translate_url_button').on('click', async () => { const optionText = $('#translation_provider option:selected').text(); - const url = await callPopup(`

${optionText} API URL

`, 'input'); + const exampleURLs = {}; + exampleURLs['libre'] = 'http://127.0.0.1:5000/translate'; + const url = await callPopup(`

${optionText} API URL

Example: ` + exampleURLs[extension_settings.translate.provider] + ``, 'input'); if (url == false) { return;