added #poe_api-presets ID to auto-switching routine

This commit is contained in:
RossAscends
2023-04-08 23:37:26 +09:00
parent 0c8f068a8a
commit 7fd5feac44

View File

@@ -453,7 +453,7 @@ async function getStatus() {
const hordeStatus = await checkHordeStatus(); const hordeStatus = await checkHordeStatus();
online_status = hordeStatus ? 'Connected' : 'no_connection'; online_status = hordeStatus ? 'Connected' : 'no_connection';
resultCheckStatus(); resultCheckStatus();
if (online_status !== "no_connection") { if (online_status !== "no_connection") {
getStatusDebounced(); getStatusDebounced();
} }
@@ -823,12 +823,12 @@ function messageFormating(mes, ch_name, isSystem, forceAvatar) {
mes = converter.makeHtml(mes); mes = converter.makeHtml(mes);
//mes = mes.replace(/{.*}/g, ""); //mes = mes.replace(/{.*}/g, "");
mes = mes.replace(/{{(\*?.+?\*?)}}/g, ""); mes = mes.replace(/{{(\*?.+?\*?)}}/g, "");
mes = mes.replace(/\n/g, "<br/>"); mes = mes.replace(/\n/g, "<br/>");
mes = mes.trim(); mes = mes.trim();
mes = mes.replace(/<code>[\s\S]*?<\/code>/g, function(match) { mes = mes.replace(/<code>[\s\S]*?<\/code>/g, function (match) {
return match.replace(/&amp;/g, '&'); return match.replace(/&amp;/g, '&');
}); });
} }
@@ -1646,7 +1646,7 @@ async function Generate(type, automatic_trigger, force_name2) {
'seed': textgenerationwebui_settings.seed, 'seed': textgenerationwebui_settings.seed,
} }
]; ];
generate_data = { "data": [ JSON.stringify(data) ]}; generate_data = { "data": [JSON.stringify(data)] };
} }
if (main_api == 'novel') { if (main_api == 'novel') {
@@ -1961,8 +1961,8 @@ async function saveChat(chat_name) {
chat[i].mes = str; chat[i].mes = str;
chat[i].name = default_user_name; chat[i].name = default_user_name;
} else if (i !== chat.length - 1 && chat[i].swipe_id !== undefined) { } else if (i !== chat.length - 1 && chat[i].swipe_id !== undefined) {
// delete chat[i].swipes; // delete chat[i].swipes;
// delete chat[i].swipe_id; // delete chat[i].swipe_id;
} }
}); });
var save_chat = [ var save_chat = [
@@ -2134,7 +2134,7 @@ function changeMainAPI() {
"poe": { "poe": {
apiSettings: $("#poe_settings"), apiSettings: $("#poe_settings"),
apiConnector: $("#poe_api"), apiConnector: $("#poe_api"),
apiPresets: $(""), apiPresets: $("#poe_api-presets"),
apiRanges: $("#range_block_poe"), apiRanges: $("#range_block_poe"),
maxContextElem: $("#max_context_block"), maxContextElem: $("#max_context_block"),
amountGenElem: $("#amount_gen_block"), amountGenElem: $("#amount_gen_block"),
@@ -2819,7 +2819,7 @@ function setExtensionPrompt(key, value, position, depth) {
} }
function updateChatMetadata(newValues, reset) { function updateChatMetadata(newValues, reset) {
chat_metadata = reset? { ...newValues } : { ...chat_metadata, ...newValues }; chat_metadata = reset ? { ...newValues } : { ...chat_metadata, ...newValues };
} }
function callPopup(text, type) { function callPopup(text, type) {
@@ -3032,7 +3032,7 @@ function closeMessageEditor() {
function setGenerationProgress(progress) { function setGenerationProgress(progress) {
if (!progress) { if (!progress) {
$('#send_textarea').css({'background': '', 'transition': ''}); $('#send_textarea').css({ 'background': '', 'transition': '' });
} }
else { else {
$('#send_textarea').css({ $('#send_textarea').css({
@@ -3065,7 +3065,7 @@ window["TavernAI"].getContext = function () {
saveChat: saveChatConditional, saveChat: saveChatConditional,
sendSystemMessage: sendSystemMessage, sendSystemMessage: sendSystemMessage,
activateSendButtons, activateSendButtons,
deactivateSendButtons, deactivateSendButtons,
saveReply, saveReply,
}; };
}; };
@@ -3087,7 +3087,7 @@ $(document).ready(function () {
///// SWIPE BUTTON CLICKS /////// ///// SWIPE BUTTON CLICKS ///////
$(document).on('click', '.swipe_right', function () { //when we click swipe right button $(document).on('click', '.swipe_right', function () { //when we click swipe right button
if (chat.length -1 === Number(this_edit_mes_id)) { if (chat.length - 1 === Number(this_edit_mes_id)) {
closeMessageEditor(); closeMessageEditor();
} }
@@ -3227,7 +3227,7 @@ $(document).ready(function () {
}); });
$(document).on('click', '.swipe_left', function () { // when we swipe left..but no generation. $(document).on('click', '.swipe_left', function () { // 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();
} }
@@ -3868,7 +3868,7 @@ $(document).ready(function () {
return; return;
} }
$("#api_url_text").val(value); $("#api_url_text").val(value);
api_server = value; api_server = value;
$("#api_loading").css("display", "inline-block"); $("#api_loading").css("display", "inline-block");
$("#api_button").css("display", "none"); $("#api_button").css("display", "none");
@@ -4292,9 +4292,9 @@ $(document).ready(function () {
this_edit_mes_id = undefined; this_edit_mes_id = undefined;
}); });
$(document).on("click", ".mes_edit_up", function() { $(document).on("click", ".mes_edit_up", function () {
if (is_send_press || this_edit_mes_id <= 0) { if (is_send_press || this_edit_mes_id <= 0) {
return; return;
} }
hideSwipeButtons(); hideSwipeButtons();
@@ -4617,9 +4617,9 @@ $(document).ready(function () {
$(this).closest('.inline-drawer').find('.inline-drawer-content').slideToggle(); $(this).closest('.inline-drawer').find('.inline-drawer-content').slideToggle();
}); });
$(document).keyup(function(e) { $(document).keyup(function (e) {
if (e.key === "Escape") { if (e.key === "Escape") {
closeMessageEditor(); closeMessageEditor();
} }
}); });
}) })