diff --git a/public/script.js b/public/script.js index 1651d786e..c3aa593e8 100644 --- a/public/script.js +++ b/public/script.js @@ -2373,7 +2373,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) { @@ -7514,7 +7514,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'); @@ -8194,6 +8194,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(); 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 },