From 3dad029091cf39175c40a44146d621471ab47411 Mon Sep 17 00:00:00 2001 From: ceruleandeep Date: Wed, 2 Oct 2024 06:55:32 +1000 Subject: [PATCH 1/2] Add Featherless to modelSelectMap for /model --- public/scripts/slash-commands.js | 1 + 1 file changed, 1 insertion(+) diff --git a/public/scripts/slash-commands.js b/public/scripts/slash-commands.js index bc0941968..a34b4e544 100644 --- a/public/scripts/slash-commands.js +++ b/public/scripts/slash-commands.js @@ -3612,6 +3612,7 @@ function getModelOptions(quiet) { { id: 'aphrodite_model', api: 'textgenerationwebui', type: textgen_types.APHRODITE }, { id: 'ollama_model', api: 'textgenerationwebui', type: textgen_types.OLLAMA }, { id: 'tabby_model', api: 'textgenerationwebui', type: textgen_types.TABBY }, + { id: 'featherless_model', api: 'textgenerationwebui', type: textgen_types.FEATHERLESS }, { id: 'model_openai_select', api: 'openai', type: chat_completion_sources.OPENAI }, { id: 'model_claude_select', api: 'openai', type: chat_completion_sources.CLAUDE }, { id: 'model_windowai_select', api: 'openai', type: chat_completion_sources.WINDOWAI }, From 85b0d135f1d709f92405566ba2e801dcf98ff28b Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Wed, 2 Oct 2024 22:22:33 +0300 Subject: [PATCH 2/2] Add utility function for formatting swipe counters --- public/script.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/public/script.js b/public/script.js index 35bfcbab0..1fd4092c6 100644 --- a/public/script.js +++ b/public/script.js @@ -2374,7 +2374,7 @@ export function addOneMessage(mes, { type = 'normal', insertAfter = null, scroll if (!params.isUser && newMessageId !== 0 && newMessageId !== chat.length - 1) { const swipesNum = chat[newMessageId].swipes?.length; const swipeId = chat[newMessageId].swipe_id + 1; - newMessage.find('.swipes-counter').text(`${swipeId}\u200B/\u200b${swipesNum}`); + newMessage.find('.swipes-counter').text(formatSwipeCounter(swipeId, swipesNum)); } if (showSwipes) { @@ -7487,7 +7487,7 @@ export function showSwipeButtons() { const currentMessage = $('#chat').children().filter(`[mesid="${chat.length - 1}"]`); const swipeId = chat[chat.length - 1].swipe_id; - const swipeCounterText = (`${(swipeId + 1)}\u200B/\u200b${(chat[chat.length - 1].swipes.length)}`); + const swipeCounterText = formatSwipeCounter((swipeId + 1), chat[chat.length - 1].swipes.length); const swipeRight = currentMessage.find('.swipe_right'); const swipeLeft = currentMessage.find('.swipe_left'); const swipeCounter = currentMessage.find('.swipes-counter'); @@ -8165,6 +8165,20 @@ window['SillyTavern'].getContext = function () { }; }; +/** + * Formats a counter for a swipe view. + * @param {number} current The current number of items. + * @param {number} total The total number of items. + * @returns {string} The formatted counter. + */ +function formatSwipeCounter(current, total) { + if (isNaN(current) || isNaN(total)) { + return ''; + } + + return `${current}\u200b/\u200b${total}`; +} + function swipe_left() { // when we swipe left..but no generation. if (chat.length - 1 === Number(this_edit_mes_id)) { closeMessageEditor();