From 6d375192208ed136c8b12dde5d2b3f38e74a072b Mon Sep 17 00:00:00 2001 From: LenAnderson Date: Mon, 8 Jan 2024 11:15:09 +0000 Subject: [PATCH 01/10] add /list-gallery command to gallery extension --- public/scripts/extensions/gallery/index.js | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/public/scripts/extensions/gallery/index.js b/public/scripts/extensions/gallery/index.js index e297c2589..815170897 100644 --- a/public/scripts/extensions/gallery/index.js +++ b/public/scripts/extensions/gallery/index.js @@ -4,7 +4,7 @@ import { characters, getRequestHeaders, } from '../../../script.js'; -import { selected_group } from '../../group-chats.js'; +import { groups, selected_group } from '../../group-chats.js'; import { loadFileToDocument, delay } from '../../utils.js'; import { loadMovingUIState } from '../../power-user.js'; import { dragElement } from '../../RossAscends-mods.js'; @@ -416,7 +416,26 @@ function viewWithDragbox(items) { // Registers a simple command for opening the char gallery. registerSlashCommand('show-gallery', showGalleryCommand, ['sg'], '– shows the gallery', true, true); +registerSlashCommand('list-gallery', listGalleryCommand, ['lg'], '[optional char=charName] [optional group=groupName] – list images in the gallery of the current char / group or a specified char / group', true, true); function showGalleryCommand(args) { showCharGallery(); } + +async function listGalleryCommand(args) { + try { + let url = args.char ?? (args.group ? groups.find(it=>it.name == args.group)?.id : null) ?? (selected_group || this_chid); + if (!args.char && !args.group && !selected_group && this_chid) { + const char = characters[this_chid]; + url = char.avatar.replace('.png', ''); + } + + const items = await getGalleryItems(url); + return JSON.stringify(items.map(it=>it.src)); + + } catch (err) { + console.trace(); + console.error(err); + } + return JSON.stringify([]); +} From adf82f2ba833a5683023b631834ce9cb4d43d2bb Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Tue, 9 Jan 2024 01:02:58 +0200 Subject: [PATCH 02/10] #1663 Add last prompt line to quiet prompts --- public/script.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/script.js b/public/script.js index adf3e1eaf..e5624965a 100644 --- a/public/script.js +++ b/public/script.js @@ -3473,7 +3473,7 @@ async function Generate(type, { automatic_trigger, force_name2, quiet_prompt, qu // need a detection for what the quiet prompt is being asked for... // Bail out early? - if (quietToLoud !== true) { + if (!isInstruct && !quietToLoud) { return lastMesString; } } @@ -3481,7 +3481,7 @@ async function Generate(type, { automatic_trigger, force_name2, quiet_prompt, qu // Get instruct mode line if (isInstruct && !isContinue) { - const name = isImpersonate ? name1 : name2; + const name = (quiet_prompt && !quietToLoud) ? 'System' : (isImpersonate ? name1 : name2); lastMesString += formatInstructModePrompt(name, isImpersonate, promptBias, name1, name2); } From 1a80ed74826682035d34b1217e70cb6a1a0dde28 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Tue, 9 Jan 2024 01:53:26 +0200 Subject: [PATCH 03/10] Fix npm audit --- package-lock.json | 6 +++--- package.json | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 282dc6ca3..248e48e13 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2413,9 +2413,9 @@ "dev": true }, "node_modules/follow-redirects": { - "version": "1.15.2", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", - "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", + "version": "1.15.4", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.4.tgz", + "integrity": "sha512-Cr4D/5wlrb0z9dgERpUL3LrmPKVDsETIJhaCMeDfuFYcqa5bldGV6wBsAN6X/vxlXQtFBMrXdXxdL8CbDTGniw==", "funding": [ { "type": "individual", diff --git a/package.json b/package.json index 1c6f278de..db996b17c 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,9 @@ }, "vectra": { "openai": "^4.17.0" + }, + "axios": { + "follow-redirects": "^1.15.4" } }, "name": "sillytavern", From ead0aa65ffc9d6259cdb85f60fba3fe9770135d3 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Tue, 9 Jan 2024 02:34:43 +0200 Subject: [PATCH 04/10] #1649 Fix inclusion groups with recursion --- public/scripts/world-info.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/public/scripts/world-info.js b/public/scripts/world-info.js index 913dbd491..42ca983fb 100644 --- a/public/scripts/world-info.js +++ b/public/scripts/world-info.js @@ -1898,6 +1898,11 @@ async function checkWorldInfo(chat, maxContext) { needsToScan = false; } + if (newEntries.length === 0) { + console.debug('No new entries activated, stopping'); + needsToScan = false; + } + if (needsToScan) { const text = newEntries .filter(x => !failedProbabilityChecks.has(x)) @@ -2006,6 +2011,10 @@ function filterByInclusionGroups(newEntries, allActivatedEntries) { if (Array.from(allActivatedEntries).some(x => x.group === key)) { console.debug(`Skipping inclusion group check, group already activated '${key}'`); + // We need to forcefully deactivate all other entries in the group + for (const entry of group) { + newEntries.splice(newEntries.indexOf(entry), 1); + } continue; } From b334acec23bd8923c4c0bd55c4b45fc0380d04ce Mon Sep 17 00:00:00 2001 From: Alexander Abushady <44341163+AAbushady@users.noreply.github.com> Date: Mon, 8 Jan 2024 22:20:27 -0500 Subject: [PATCH 05/10] DynaTemp UI v3 Backend bros won't play along now we gotta make them hold hands. --- public/index.html | 19 +++++++++++++++---- public/scripts/power-user.js | 10 ++++++---- public/scripts/textgen-settings.js | 13 ++++++++++--- 3 files changed, 31 insertions(+), 11 deletions(-) diff --git a/public/index.html b/public/index.html index c7f6a041d..48ccb4037 100644 --- a/public/index.html +++ b/public/index.html @@ -1317,13 +1317,24 @@

DynaTemp -
+

+
+ +
- DynaTemp Range - - + Min Temp + + +
+
+ Max Temp + +
diff --git a/public/scripts/power-user.js b/public/scripts/power-user.js index 035ed9d83..1f40c72b2 100644 --- a/public/scripts/power-user.js +++ b/public/scripts/power-user.js @@ -608,7 +608,8 @@ async function CreateZenSliders(elmnt) { sliderID == 'rep_pen_range') { decimals = 0; } - if (sliderID == 'dynatemp_range_textgenerationwebui') { + if (sliderID == 'min_temp_textgenerationwebui' || + sliderID == 'max_temp_textgenerationwebui') { decimals = 2; } if (sliderID == 'eta_cutoff_textgenerationwebui' || @@ -635,13 +636,14 @@ async function CreateZenSliders(elmnt) { sliderID == 'tfs_textgenerationwebui' || sliderID == 'min_p_textgenerationwebui' || sliderID == 'temp_textgenerationwebui' || - sliderID == 'temp' || - sliderID == 'dynatemp_range_textgenerationwebui') { + sliderID == 'temp') { numSteps = 20; } if (sliderID == 'mirostat_eta_textgenerationwebui' || sliderID == 'penalty_alpha_textgenerationwebui' || - sliderID == 'length_penalty_textgenerationwebui') { + sliderID == 'length_penalty_textgenerationwebui' || + sliderID == 'min_temp_textgenerationwebui' || + sliderID == 'max_temp_textgenerationwebui') { numSteps = 50; } //customize off values diff --git a/public/scripts/textgen-settings.js b/public/scripts/textgen-settings.js index ed834c38a..61cafad5e 100644 --- a/public/scripts/textgen-settings.js +++ b/public/scripts/textgen-settings.js @@ -79,7 +79,9 @@ const settings = { presence_pen: 0, do_sample: true, early_stopping: false, - dynatemp_range: 0, + dynatemp: false, + min_temp: 0, + max_temp: 2.0, seed: -1, preset: 'Default', add_bos_token: true, @@ -138,7 +140,9 @@ const setting_names = [ 'num_beams', 'length_penalty', 'min_length', - 'dynatemp_range', + 'dynatemp', + 'min_temp', + 'max_temp', 'encoder_rep_pen', 'freq_pen', 'presence_pen', @@ -720,7 +724,10 @@ export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate, 'length_penalty': settings.length_penalty, 'early_stopping': settings.early_stopping, 'add_bos_token': settings.add_bos_token, - 'dynatemp_range': settings.dynatemp_range, + 'dynatemp': settings.dynatemp, + 'dynatemp_low': settings.min_temp, + 'dynatemp_high': settings.max_temp, + 'dynatemp_range': (settings.min_temp + settings.max_temp) / 2, 'stopping_strings': getStoppingStrings(isImpersonate, isContinue), 'stop': getStoppingStrings(isImpersonate, isContinue), 'truncation_length': max_context, From 04a5d8390d4d6d74b99323133d40caac28786940 Mon Sep 17 00:00:00 2001 From: Alexander Abushady <44341163+AAbushady@users.noreply.github.com> Date: Mon, 8 Jan 2024 23:58:06 -0500 Subject: [PATCH 06/10] Dynatemp UI v3.1 fixes for html positioning as well as api settings. --- public/index.html | 47 +++++++++++++++--------------- public/scripts/textgen-settings.js | 4 +-- 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/public/index.html b/public/index.html index 48ccb4037..f88ad0d04 100644 --- a/public/index.html +++ b/public/index.html @@ -1270,6 +1270,30 @@ --> +
+

+
+
+ + +
+ Dynamic Temperature +
+
+

+
+
+ Minimum Temp + + +
+
+ Maximum Temp + + +
+
+

Mirostat
@@ -1315,29 +1339,6 @@

-
-

DynaTemp -
-

-
-
- -
-
- Min Temp - - -
-
- Max Temp - - -
-
-

Contrast Search
diff --git a/public/scripts/textgen-settings.js b/public/scripts/textgen-settings.js index 61cafad5e..42385ec0a 100644 --- a/public/scripts/textgen-settings.js +++ b/public/scripts/textgen-settings.js @@ -710,7 +710,7 @@ export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate, 'model': getModel(), 'max_new_tokens': maxTokens, 'max_tokens': maxTokens, - 'temperature': settings.temp, + 'temperature': settings.dynatemp ? (settings.min_temp + settings.max_temp) / 2 : settings.temp, 'top_p': settings.top_p, 'typical_p': settings.typical_p, 'min_p': settings.min_p, @@ -727,7 +727,7 @@ export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate, 'dynatemp': settings.dynatemp, 'dynatemp_low': settings.min_temp, 'dynatemp_high': settings.max_temp, - 'dynatemp_range': (settings.min_temp + settings.max_temp) / 2, + 'dynatemp_range': (settings.max_temp - settings.min_temp) / 2, 'stopping_strings': getStoppingStrings(isImpersonate, isContinue), 'stop': getStoppingStrings(isImpersonate, isContinue), 'truncation_length': max_context, From 5ad980cf999d4f4e32ce4a2221dd2dd45a407eeb Mon Sep 17 00:00:00 2001 From: Alexander Abushady <44341163+AAbushady@users.noreply.github.com> Date: Tue, 9 Jan 2024 00:02:53 -0500 Subject: [PATCH 07/10] Fix for realzies --- public/scripts/textgen-settings.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/scripts/textgen-settings.js b/public/scripts/textgen-settings.js index 42385ec0a..cf1afccb1 100644 --- a/public/scripts/textgen-settings.js +++ b/public/scripts/textgen-settings.js @@ -724,7 +724,7 @@ export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate, 'length_penalty': settings.length_penalty, 'early_stopping': settings.early_stopping, 'add_bos_token': settings.add_bos_token, - 'dynatemp': settings.dynatemp, + 'dynamic_temperature': settings.dynatemp, 'dynatemp_low': settings.min_temp, 'dynatemp_high': settings.max_temp, 'dynatemp_range': (settings.max_temp - settings.min_temp) / 2, From ec63cd8b6de6c0b9b5e4cb8cac2efbb6009d6c47 Mon Sep 17 00:00:00 2001 From: Alexander Abushady <44341163+AAbushady@users.noreply.github.com> Date: Tue, 9 Jan 2024 00:54:20 -0500 Subject: [PATCH 08/10] Dynatemp Range Kobold Dynatemp range set when deactivated, now will work properly --- public/scripts/textgen-settings.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/scripts/textgen-settings.js b/public/scripts/textgen-settings.js index cf1afccb1..037bb1b5d 100644 --- a/public/scripts/textgen-settings.js +++ b/public/scripts/textgen-settings.js @@ -727,7 +727,7 @@ export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate, 'dynamic_temperature': settings.dynatemp, 'dynatemp_low': settings.min_temp, 'dynatemp_high': settings.max_temp, - 'dynatemp_range': (settings.max_temp - settings.min_temp) / 2, + 'dynatemp_range': settings.dynatemp ? (settings.max_temp - settings.min_temp) / 2 : 0, 'stopping_strings': getStoppingStrings(isImpersonate, isContinue), 'stop': getStoppingStrings(isImpersonate, isContinue), 'truncation_length': max_context, From 1c830865159d42b2795bda5696220506320cefe8 Mon Sep 17 00:00:00 2001 From: Alexander Abushady <44341163+AAbushady@users.noreply.github.com> Date: Tue, 9 Jan 2024 01:12:27 -0500 Subject: [PATCH 09/10] Update temperature max value to 5 For parity's sake --- public/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/index.html b/public/index.html index f88ad0d04..41e71abf0 100644 --- a/public/index.html +++ b/public/index.html @@ -1161,8 +1161,8 @@ Temperature
- - + +

From aa796e5aae9b05e9a844de1be87ef82886ea36e5 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Tue, 9 Jan 2024 11:48:51 +0200 Subject: [PATCH 10/10] #1649 Fix deactivation of singular group entry per recursion step --- public/scripts/world-info.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/public/scripts/world-info.js b/public/scripts/world-info.js index 42ca983fb..4a7f8ac6a 100644 --- a/public/scripts/world-info.js +++ b/public/scripts/world-info.js @@ -2004,11 +2004,6 @@ function filterByInclusionGroups(newEntries, allActivatedEntries) { for (const [key, group] of Object.entries(grouped)) { console.debug(`Checking inclusion group '${key}' with ${group.length} entries`, group); - if (!Array.isArray(group) || group.length <= 1) { - console.debug('Skipping inclusion group check, only one entry'); - continue; - } - if (Array.from(allActivatedEntries).some(x => x.group === key)) { console.debug(`Skipping inclusion group check, group already activated '${key}'`); // We need to forcefully deactivate all other entries in the group @@ -2018,6 +2013,11 @@ function filterByInclusionGroups(newEntries, allActivatedEntries) { continue; } + if (!Array.isArray(group) || group.length <= 1) { + console.debug('Skipping inclusion group check, only one entry'); + continue; + } + // Do weighted random using probability of entry as weight const totalWeight = group.reduce((acc, item) => acc + item.probability, 0); const rollValue = Math.random() * totalWeight;