mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Merge branch 'staging' into qr-context
This commit is contained in:
@ -1513,7 +1513,7 @@
|
|||||||
<option value="kobold"><span data-i18n="KoboldAI">KoboldAI Classic</span></option>
|
<option value="kobold"><span data-i18n="KoboldAI">KoboldAI Classic</span></option>
|
||||||
<option value="koboldhorde"><span data-i18n="KoboldAI Horde">KoboldAI Horde</span></option>
|
<option value="koboldhorde"><span data-i18n="KoboldAI Horde">KoboldAI Horde</span></option>
|
||||||
<option value="novel"><span data-i18n="NovelAI">NovelAI</span></option>
|
<option value="novel"><span data-i18n="NovelAI">NovelAI</span></option>
|
||||||
<option value="textgenerationwebui"><span data-i18n="Text Completion">Text Completion (ooba, Mancer, Aphrodite, KoboldCpp)</span></option>
|
<option value="textgenerationwebui"><span data-i18n="Text Completion">Text Completion (ooba, Mancer, Aphrodite, TabbyAPI, KoboldCpp)</span></option>
|
||||||
<option value="openai"><span data-i18n="Chat Completion (OpenAI, Claude, Window/OpenRouter, Scale, AI21)">Chat Completion (OpenAI, Claude, Window, OpenRouter, Scale, AI21, PaLM)</span></option>
|
<option value="openai"><span data-i18n="Chat Completion (OpenAI, Claude, Window/OpenRouter, Scale, AI21)">Chat Completion (OpenAI, Claude, Window, OpenRouter, Scale, AI21, PaLM)</span></option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@ -3789,6 +3789,7 @@
|
|||||||
<span id="ChatHistoryCharName"></span><span data-i18n="Chat History">Chat History</span>
|
<span id="ChatHistoryCharName"></span><span data-i18n="Chat History">Chat History</span>
|
||||||
<a href="https://docs.sillytavern.app/usage/core-concepts/chatfilemanagement/#chat-import" class="notes-link" target="_blank"><span class="fa-solid fa-circle-question note-link-span"></span></a>
|
<a href="https://docs.sillytavern.app/usage/core-concepts/chatfilemanagement/#chat-import" class="notes-link" target="_blank"><span class="fa-solid fa-circle-question note-link-span"></span></a>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="fa-solid fa-plus menu_button" title="New Chat" id="newChatFromManageScreenButton"></div>
|
||||||
<input type="text" id="select_chat_search" class="menu_button" placeholder="Search..." autocomplete="off">
|
<input type="text" id="select_chat_search" class="menu_button" placeholder="Search..." autocomplete="off">
|
||||||
<div id="select_chat_cross" class="opacity50p hoverglow fa-solid fa-circle-xmark fontsize120p" alt="Close Past Chat Popup"></div>
|
<div id="select_chat_cross" class="opacity50p hoverglow fa-solid fa-circle-xmark fontsize120p" alt="Close Past Chat Popup"></div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -7833,20 +7833,22 @@ jQuery(async function () {
|
|||||||
|
|
||||||
if (popup_type == "del_chat") {
|
if (popup_type == "del_chat") {
|
||||||
//close past chat popup
|
//close past chat popup
|
||||||
$("#select_chat_cross").click();
|
$("#select_chat_cross").trigger('click');
|
||||||
|
showLoader()
|
||||||
if (selected_group) {
|
if (selected_group) {
|
||||||
await deleteGroupChat(selected_group, chat_file_for_del);
|
await deleteGroupChat(selected_group, chat_file_for_del);
|
||||||
} else {
|
} else {
|
||||||
await delChat(chat_file_for_del);
|
await delChat(chat_file_for_del);
|
||||||
}
|
}
|
||||||
|
|
||||||
//open the history view again after 100ms
|
//open the history view again after 2seconds (delay to avoid edge cases for deleting last chat)
|
||||||
//hide option popup menu
|
//hide option popup menu
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
$("#option_select_chat").click();
|
$("#option_select_chat").click();
|
||||||
$("#options").hide();
|
$("#options").hide();
|
||||||
|
hideLoader()
|
||||||
}, 2000);
|
}, 2000);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (popup_type == "del_ch") {
|
if (popup_type == "del_ch") {
|
||||||
const deleteChats = !!$("#del_char_checkbox").prop("checked");
|
const deleteChats = !!$("#del_char_checkbox").prop("checked");
|
||||||
@ -8306,6 +8308,17 @@ jQuery(async function () {
|
|||||||
hideMenu();
|
hideMenu();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$("#newChatFromManageScreenButton").on('click', function () {
|
||||||
|
setTimeout(() => {
|
||||||
|
$("#option_start_new_chat").trigger('click');
|
||||||
|
}, 1);
|
||||||
|
setTimeout(() => {
|
||||||
|
$("#dialogue_popup_ok").trigger('click');
|
||||||
|
}, 1);
|
||||||
|
$("#select_chat_cross").trigger('click')
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
//functionality for the cancel delete messages button, reverts to normal display of input form
|
//functionality for the cancel delete messages button, reverts to normal display of input form
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { saveSettingsDebounced, callPopup, getRequestHeaders, substituteParams } from "../../../script.js";
|
import { saveSettingsDebounced, callPopup, getRequestHeaders, substituteParams } from "../../../script.js";
|
||||||
import { getContext, extension_settings } from "../../extensions.js";
|
import { getContext, extension_settings } from "../../extensions.js";
|
||||||
import { initScrollHeight, resetScrollHeight } from "../../utils.js";
|
import { initScrollHeight, resetScrollHeight, getSortableDelay } from "../../utils.js";
|
||||||
import { executeSlashCommands, registerSlashCommand } from "../../slash-commands.js";
|
import { executeSlashCommands, registerSlashCommand } from "../../slash-commands.js";
|
||||||
import { ContextMenu } from "./src/ContextMenu.js";
|
import { ContextMenu } from "./src/ContextMenu.js";
|
||||||
import { MenuItem } from "./src/MenuItem.js";
|
import { MenuItem } from "./src/MenuItem.js";
|
||||||
@ -308,6 +308,50 @@ async function saveQuickReplyPreset() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//just a copy of save function with the name hardcoded to currently selected preset
|
||||||
|
async function updateQuickReplyPreset() {
|
||||||
|
const name = $("#quickReplyPresets").val()
|
||||||
|
|
||||||
|
if (!name) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const quickReplyPreset = {
|
||||||
|
name: name,
|
||||||
|
quickReplyEnabled: extension_settings.quickReply.quickReplyEnabled,
|
||||||
|
quickReplySlots: extension_settings.quickReply.quickReplySlots,
|
||||||
|
numberOfSlots: extension_settings.quickReply.numberOfSlots,
|
||||||
|
AutoInputInject: extension_settings.quickReply.AutoInputInject,
|
||||||
|
selectedPreset: name,
|
||||||
|
}
|
||||||
|
|
||||||
|
const response = await fetch('/savequickreply', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: getRequestHeaders(),
|
||||||
|
body: JSON.stringify(quickReplyPreset)
|
||||||
|
});
|
||||||
|
|
||||||
|
if (response.ok) {
|
||||||
|
const quickReplyPresetIndex = presets.findIndex(x => x.name == name);
|
||||||
|
|
||||||
|
if (quickReplyPresetIndex == -1) {
|
||||||
|
presets.push(quickReplyPreset);
|
||||||
|
const option = document.createElement('option');
|
||||||
|
option.selected = true;
|
||||||
|
option.value = name;
|
||||||
|
option.innerText = name;
|
||||||
|
$('#quickReplyPresets').append(option);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
presets[quickReplyPresetIndex] = quickReplyPreset;
|
||||||
|
$(`#quickReplyPresets option[value="${name}"]`).prop('selected', true);
|
||||||
|
}
|
||||||
|
saveSettingsDebounced();
|
||||||
|
} else {
|
||||||
|
toastr.warning('Failed to save Quick Reply Preset.')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function onQuickReplyNumberOfSlotsInput() {
|
async function onQuickReplyNumberOfSlotsInput() {
|
||||||
const $input = $('#quickReplyNumberOfSlots');
|
const $input = $('#quickReplyNumberOfSlots');
|
||||||
let numberOfSlots = Number($input.val());
|
let numberOfSlots = Number($input.val());
|
||||||
@ -351,8 +395,10 @@ function generateQuickReplyElements() {
|
|||||||
let quickReplyHtml = '';
|
let quickReplyHtml = '';
|
||||||
|
|
||||||
for (let i = 1; i <= extension_settings.quickReply.numberOfSlots; i++) {
|
for (let i = 1; i <= extension_settings.quickReply.numberOfSlots; i++) {
|
||||||
|
let itemNumber = i + 1
|
||||||
quickReplyHtml += `
|
quickReplyHtml += `
|
||||||
<div class="flex-container alignitemsflexstart">
|
<div class="flex-container alignitemscenter" data-order="${i}"}>
|
||||||
|
<span class="drag-handle ui-sortable-handle">☰</span>
|
||||||
<input class="text_pole wide30p" id="quickReply${i}Label" placeholder="(Button label)">
|
<input class="text_pole wide30p" id="quickReply${i}Label" placeholder="(Button label)">
|
||||||
<textarea id="quickReply${i}Mes" placeholder="(Custom message or /command)" class="text_pole widthUnset flex1 autoSetHeight" rows="2"></textarea>
|
<textarea id="quickReply${i}Mes" placeholder="(Custom message or /command)" class="text_pole widthUnset flex1 autoSetHeight" rows="2"></textarea>
|
||||||
</div>
|
</div>
|
||||||
@ -412,6 +458,25 @@ async function doQR(_, text) {
|
|||||||
whichQR.trigger('click')
|
whichQR.trigger('click')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function saveQROrder() {
|
||||||
|
//update html-level order data to match new sort
|
||||||
|
let i = 1
|
||||||
|
$('#quickReplyContainer').children().each(function () {
|
||||||
|
$(this).attr('data-order', i)
|
||||||
|
$(this).find('input').attr('id', `quickReply${i}Label`)
|
||||||
|
$(this).find('textarea').attr('id', `quickReply${i}Mes`)
|
||||||
|
i++
|
||||||
|
});
|
||||||
|
|
||||||
|
//rebuild the extension_Settings array based on new order
|
||||||
|
i = 1
|
||||||
|
$('#quickReplyContainer').children().each(function () {
|
||||||
|
onQuickReplyLabelInput(i)
|
||||||
|
onQuickReplyInput(i)
|
||||||
|
i++
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
jQuery(async () => {
|
jQuery(async () => {
|
||||||
moduleWorker();
|
moduleWorker();
|
||||||
setInterval(moduleWorker, UPDATE_INTERVAL);
|
setInterval(moduleWorker, UPDATE_INTERVAL);
|
||||||
@ -446,7 +511,10 @@ jQuery(async () => {
|
|||||||
</select>
|
</select>
|
||||||
<div id="quickReplyPresetSaveButton" class="menu_button menu_button_icon">
|
<div id="quickReplyPresetSaveButton" class="menu_button menu_button_icon">
|
||||||
<div class="fa-solid fa-save"></div>
|
<div class="fa-solid fa-save"></div>
|
||||||
<span>Save</span>
|
<span>Save New</span>
|
||||||
|
</div>
|
||||||
|
<div id="quickReplyPresetUpdateButton" class="menu_button menu_button_icon">
|
||||||
|
<span>Update</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<label for="quickReplyNumberOfSlots">Number of slots:</label>
|
<label for="quickReplyNumberOfSlots">Number of slots:</label>
|
||||||
@ -473,6 +541,12 @@ jQuery(async () => {
|
|||||||
$('#quickReplyEnabled').on('input', onQuickReplyEnabledInput);
|
$('#quickReplyEnabled').on('input', onQuickReplyEnabledInput);
|
||||||
$('#quickReplyNumberOfSlotsApply').on('click', onQuickReplyNumberOfSlotsInput);
|
$('#quickReplyNumberOfSlotsApply').on('click', onQuickReplyNumberOfSlotsInput);
|
||||||
$("#quickReplyPresetSaveButton").on('click', saveQuickReplyPreset);
|
$("#quickReplyPresetSaveButton").on('click', saveQuickReplyPreset);
|
||||||
|
$("#quickReplyPresetUpdateButton").on('click', updateQuickReplyPreset);
|
||||||
|
|
||||||
|
$('#quickReplyContainer').sortable({
|
||||||
|
delay: getSortableDelay(),
|
||||||
|
stop: saveQROrder,
|
||||||
|
});
|
||||||
|
|
||||||
$("#quickReplyPresets").on('change', async function () {
|
$("#quickReplyPresets").on('change', async function () {
|
||||||
const quickReplyPresetSelected = $(this).find(':selected').val();
|
const quickReplyPresetSelected = $(this).find(':selected').val();
|
||||||
|
@ -596,6 +596,10 @@ app.post("/api/textgenerationwebui/status", jsonParser, async function (request,
|
|||||||
|
|
||||||
const modelName = modelInfo?.id;
|
const modelName = modelInfo?.id;
|
||||||
result = modelName || result;
|
result = modelName || result;
|
||||||
|
} else {
|
||||||
|
// TabbyAPI returns an error 400 if a model isn't loaded
|
||||||
|
|
||||||
|
result = "None"
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(`Failed to get TabbyAPI model info: ${error}`);
|
console.error(`Failed to get TabbyAPI model info: ${error}`);
|
||||||
|
Reference in New Issue
Block a user