Merge branch 'staging' into tool-calling

This commit is contained in:
Cohee 2024-10-02 22:35:33 +03:00
commit c3e9d25307
2 changed files with 17 additions and 2 deletions

View File

@ -2373,7 +2373,7 @@ export function addOneMessage(mes, { type = 'normal', insertAfter = null, scroll
if (!params.isUser && newMessageId !== 0 && newMessageId !== chat.length - 1) { if (!params.isUser && newMessageId !== 0 && newMessageId !== chat.length - 1) {
const swipesNum = chat[newMessageId].swipes?.length; const swipesNum = chat[newMessageId].swipes?.length;
const swipeId = chat[newMessageId].swipe_id + 1; 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) { if (showSwipes) {
@ -7514,7 +7514,7 @@ export function showSwipeButtons() {
const currentMessage = $('#chat').children().filter(`[mesid="${chat.length - 1}"]`); const currentMessage = $('#chat').children().filter(`[mesid="${chat.length - 1}"]`);
const swipeId = chat[chat.length - 1].swipe_id; 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 swipeRight = currentMessage.find('.swipe_right');
const swipeLeft = currentMessage.find('.swipe_left'); const swipeLeft = currentMessage.find('.swipe_left');
const swipeCounter = currentMessage.find('.swipes-counter'); 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. function swipe_left() { // when we swipe left..but no generation.
if (chat.length - 1 === Number(this_edit_mes_id)) { if (chat.length - 1 === Number(this_edit_mes_id)) {
closeMessageEditor(); closeMessageEditor();

View File

@ -3612,6 +3612,7 @@ function getModelOptions(quiet) {
{ id: 'aphrodite_model', api: 'textgenerationwebui', type: textgen_types.APHRODITE }, { id: 'aphrodite_model', api: 'textgenerationwebui', type: textgen_types.APHRODITE },
{ id: 'ollama_model', api: 'textgenerationwebui', type: textgen_types.OLLAMA }, { id: 'ollama_model', api: 'textgenerationwebui', type: textgen_types.OLLAMA },
{ id: 'tabby_model', api: 'textgenerationwebui', type: textgen_types.TABBY }, { 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_openai_select', api: 'openai', type: chat_completion_sources.OPENAI },
{ id: 'model_claude_select', api: 'openai', type: chat_completion_sources.CLAUDE }, { id: 'model_claude_select', api: 'openai', type: chat_completion_sources.CLAUDE },
{ id: 'model_windowai_select', api: 'openai', type: chat_completion_sources.WINDOWAI }, { id: 'model_windowai_select', api: 'openai', type: chat_completion_sources.WINDOWAI },