From 4200f1da0a58cb7cd1cf618096ba37d4984ac6e3 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Thu, 10 Aug 2023 10:57:31 +0300 Subject: [PATCH 1/9] is a valid HTML tag --- public/style.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/public/style.css b/public/style.css index f3ea476aa..90f20624b 100644 --- a/public/style.css +++ b/public/style.css @@ -222,6 +222,10 @@ table.responsiveTable { font-weight: 500; } +.mes_text rp { + display: block; +} + .mes_text blockquote { border-left: 3px solid var(--SmartThemeQuoteColor); padding-left: 10px; From 1a07fa8365ffd69fc818b520a43e6890ea3d89e0 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Thu, 10 Aug 2023 11:47:17 +0300 Subject: [PATCH 2/9] [Feature Request] Can we please have visibility back? #907 --- public/index.html | 42 +++++++++++++++++++++--------------- public/script.js | 6 ++++-- public/scripts/power-user.js | 8 +++++++ public/style.css | 1 - 4 files changed, 37 insertions(+), 20 deletions(-) diff --git a/public/index.html b/public/index.html index 45e580bed..06626b74e 100644 --- a/public/index.html +++ b/public/index.html @@ -2482,11 +2482,11 @@

Power User Options

-
-
- Samplers Order +
+ Samplers Order
Samplers will be applied in a top-down order. Use with caution.
-
Top K
-
Top A
-
Top P
-
Tail Free Sampling
-
Typical Sampling
-
Temperature
-
Repetition Penalty
+
+ Top K + 0 +
+
+ Top A + 1 +
+
+ Top P + 2 +
+
+ Tail Free Sampling + 3 +
+
+ Typical Sampling + 4 +
+
+ Temperature + 5 +
+
+ Repetition Penalty + 6 +
+
+
diff --git a/public/scripts/kai-settings.js b/public/scripts/kai-settings.js index 07bb1b0d1..302e45d5d 100644 --- a/public/scripts/kai-settings.js +++ b/public/scripts/kai-settings.js @@ -35,6 +35,7 @@ const kai_settings = { const MIN_STOP_SEQUENCE_VERSION = '1.2.2'; const MIN_STREAMING_KCPPVERSION = '1.30'; +const KOBOLDCPP_ORDER = [6, 0, 1, 3, 4, 2, 5]; function formatKoboldUrl(value) { try { @@ -143,7 +144,7 @@ export async function generateKoboldWithStreaming(generate_data, signal) { if (done) { return; - } + } } } } @@ -276,4 +277,10 @@ $(document).ready(function () { saveSettingsDebounced(); }, }); + + $('#samplers_order_recommended').on('click', function () { + kai_settings.sampler_order = KOBOLDCPP_ORDER; + sortItemsByOrder(kai_settings.sampler_order); + saveSettingsDebounced(); + }); }); diff --git a/public/style.css b/public/style.css index 696973518..9fa03bd64 100644 --- a/public/style.css +++ b/public/style.css @@ -2164,6 +2164,9 @@ grammarly-extension { transition: background-color 200ms ease-in-out; position: relative; user-select: none; + display: flex; + align-items: center; + justify-content: space-between; } #kobold_order>div:hover { From 262299928470903591b43b123a40003010d2f98e Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Thu, 10 Aug 2023 12:42:52 +0300 Subject: [PATCH 4/9] #911 Fix expressions --- .../scripts/extensions/expressions/index.js | 56 +++++++++---------- 1 file changed, 26 insertions(+), 30 deletions(-) diff --git a/public/scripts/extensions/expressions/index.js b/public/scripts/extensions/expressions/index.js index 0c642479b..b40c28c4e 100644 --- a/public/scripts/extensions/expressions/index.js +++ b/public/scripts/extensions/expressions/index.js @@ -515,7 +515,7 @@ async function moduleWorker() { //set checkbox to global var $('#image_type_toggle').prop('checked', extension_settings.expressions.live2d); - if(extension_settings.expressions.live2d == true){ + if (extension_settings.expressions.live2d) { setLive2dState(extension_settings.expressions.live2d); } } @@ -641,11 +641,11 @@ async function live2dcheck() { let live2dObj = spriteCache[spriteFolderName].find(obj => obj.label === 'live2d'); let live2dPath_f = live2dObj ? live2dObj.path : null; - if(live2dPath_f != null){ + if (live2dPath_f != null) { //console.log("live2dPath_f " + live2dPath_f); return true; - } else { - //console.log("live2dPath_f is null"); + } else { + //console.log("live2dPath_f is null"); unloadLiveChar(); return false; } @@ -654,7 +654,7 @@ async function live2dcheck() { } } -function setLive2dState(switch_var){ +function setLive2dState(switch_var) { extension_settings.expressions.live2d = switch_var; // Store setting saveSettingsDebounced(); @@ -662,22 +662,18 @@ function setLive2dState(switch_var){ if (result) { //console.log("Live2d exists!"); - if (extension_settings.expressions.live2d) { - loadLiveChar(); - } else { - unloadLiveChar(); - } - handleImageChange(switch_var); // Change image as needed + if (extension_settings.expressions.live2d) { + loadLiveChar(); + } else { + unloadLiveChar(); + } + handleImageChange(switch_var); // Change image as needed } else { //console.log("Live2d does not exist."); } }); - - - - } function getSpriteFolderName(message) { @@ -867,8 +863,7 @@ async function getExpressionsList() { } async function setExpression(character, expression, force) { - if (extension_settings.expressions.live2d == false) { - + if (!extension_settings.expressions.live2d) { console.debug('entered setExpressions'); await validateImages(character); const img = $('img.expression'); @@ -982,14 +977,14 @@ async function setExpression(character, expression, force) { live2dcheck().then(result => { if (result) { - // Find the element with id="expression-image" and class="expression" - const imgElement = document.querySelector('img#expression-image.expression'); - //console.log("searching"); - if (imgElement) { - //console.log("setting value"); - imgElement.src = getApiUrl() + '/api/live2d/result_feed'; - } - + // Find the element with id="expression-image" and class="expression" + const imgElement = document.querySelector('img#expression-image.expression'); + //console.log("searching"); + if (imgElement) { + //console.log("setting value"); + imgElement.src = getApiUrl() + '/api/live2d/result_feed'; + } + } else { //console.log("The fetch failed!"); } @@ -1254,14 +1249,15 @@ function setExpressionOverrideHtml(forceClear = false) {
- +
-
-
+ + +
+
You are in offline mode. Click on the image below to set the expression.
From 2e81e47967ccc0b0a85debcdecf277d21e9a2f11 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Thu, 10 Aug 2023 12:47:56 +0300 Subject: [PATCH 5/9] Fix default expressions --- public/scripts/extensions/expressions/index.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/public/scripts/extensions/expressions/index.js b/public/scripts/extensions/expressions/index.js index b40c28c4e..2e6e7e67a 100644 --- a/public/scripts/extensions/expressions/index.js +++ b/public/scripts/extensions/expressions/index.js @@ -956,10 +956,11 @@ async function setExpression(character, expression, force) { setDefault(); } }); - } else { - if (extension_settings.expressions.showDefault) { - setDefault(); - } + } + } + else { + if (extension_settings.expressions.showDefault) { + setDefault(); } } From ea4b1759aaef3b11655a0884dd4aded4c01c423f Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Thu, 10 Aug 2023 12:48:59 +0300 Subject: [PATCH 6/9] Bump package version --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index e856cd920..28d9620b8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "sillytavern", - "version": "1.9.6", + "version": "1.9.7", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "sillytavern", - "version": "1.9.6", + "version": "1.9.7", "license": "AGPL-3.0", "dependencies": { "@dqbd/tiktoken": "^1.0.2", diff --git a/package.json b/package.json index f74027506..a148295e2 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "type": "git", "url": "https://github.com/SillyTavern/SillyTavern.git" }, - "version": "1.9.6", + "version": "1.9.7", "scripts": { "start": "node server.js", "start-multi": "node server.js --disableCsrf", From aa49efe65648b7011deb34c85601094d93d068c9 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Thu, 10 Aug 2023 12:58:21 +0300 Subject: [PATCH 7/9] More precise prompt costs --- public/scripts/openai.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/scripts/openai.js b/public/scripts/openai.js index 8393b4ed2..b2cb2659a 100644 --- a/public/scripts/openai.js +++ b/public/scripts/openai.js @@ -707,7 +707,7 @@ function calculateOpenRouterCost() { const promptTokens = (oai_settings.openai_max_context - completionTokens); const totalCost = (completionCost * completionTokens) + (promptCost * promptTokens); if (!isNaN(totalCost)) { - cost = totalCost.toFixed(2); + cost = totalCost.toFixed(3); } } From c6b18de4ef5396c45d1879d6a48b363b880dd3e6 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Thu, 10 Aug 2023 13:01:55 +0300 Subject: [PATCH 8/9] Currency formatting --- public/index.html | 2 +- public/scripts/openai.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/index.html b/public/index.html index 58f8d72f2..7b647d3db 100644 --- a/public/index.html +++ b/public/index.html @@ -1775,7 +1775,7 @@ - Max prompt cost: Unknown USD + Max prompt cost: Unknown

OpenRouter API Key

diff --git a/public/scripts/openai.js b/public/scripts/openai.js index b2cb2659a..127b7cc4d 100644 --- a/public/scripts/openai.js +++ b/public/scripts/openai.js @@ -707,7 +707,7 @@ function calculateOpenRouterCost() { const promptTokens = (oai_settings.openai_max_context - completionTokens); const totalCost = (completionCost * completionTokens) + (promptCost * promptTokens); if (!isNaN(totalCost)) { - cost = totalCost.toFixed(3); + cost = '$' + totalCost.toFixed(3); } } From f226fe99aac9947ff5dbc83fc09dabdf6af2d075 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Thu, 10 Aug 2023 13:18:12 +0300 Subject: [PATCH 9/9] Showdown render tables --- public/script.js | 2 ++ public/style.css | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/public/script.js b/public/script.js index cb48fe45a..6a800a9fc 100644 --- a/public/script.js +++ b/public/script.js @@ -679,6 +679,7 @@ function reloadMarkdownProcessor(render_formulas = false) { converter = new showdown.Converter({ emoji: "true", underline: "true", + tables: "true", parseImgDimensions: "true", extensions: [ showdownKatex( @@ -696,6 +697,7 @@ function reloadMarkdownProcessor(render_formulas = false) { emoji: "true", literalMidWordUnderscores: "true", parseImgDimensions: "true", + tables: "true", }); } diff --git a/public/style.css b/public/style.css index 9fa03bd64..16af7fa75 100644 --- a/public/style.css +++ b/public/style.css @@ -188,6 +188,18 @@ table.responsiveTable { text-align: center; } +.mes_text table { + border-spacing: 0; + border-collapse: collapse; +} + +.mes_text td, +.mes_text th { + border: 1px solid; + border-collapse: collapse; + padding: 0.25em; +} + .mes_text p { margin-top: 0; margin-bottom: 10px;