Post-merge fix

This commit is contained in:
SillyLossy
2023-03-17 19:55:40 +02:00
parent 2b3910b968
commit 8beb1ade21
2 changed files with 30 additions and 5 deletions

View File

@@ -754,6 +754,7 @@
</label> </label>
<label for="force-pygmalion-formatting-checkbox"><input id="force-pygmalion-formatting-checkbox" type="checkbox" /> <label for="force-pygmalion-formatting-checkbox"><input id="force-pygmalion-formatting-checkbox" type="checkbox" />
<h4>Force Pygmalion formatting for any model</h4> <h4>Force Pygmalion formatting for any model</h4>
</label>
<label for="swipes-checkbox"><input id="swipes-checkbox" type="checkbox" /> <label for="swipes-checkbox"><input id="swipes-checkbox" type="checkbox" />
<h4>Swipes</h4> <h4>Swipes</h4>
</label> </label>

View File

@@ -731,7 +731,7 @@ function appendImageToMessage(mes, messageElement) {
} }
} }
function addOneMessage(mes) { function addOneMessage(mes, type = "normal") {
//var message = mes['mes']; //var message = mes['mes'];
//message = mes['mes'].replace(/^\s+/g, ''); //message = mes['mes'].replace(/^\s+/g, '');
//console.log(message.indexOf(name1+":")); //console.log(message.indexOf(name1+":"));
@@ -1043,12 +1043,14 @@ async function Generate(type, automatic_trigger) {
var chatString = ""; var chatString = "";
var arrMes = []; var arrMes = [];
var mesSend = []; var mesSend = [];
var mesExamplesArray = [];
var charDescription = baseChatReplaceAndSplit($.trim(characters[this_chid].description), name1, name2); var charDescription = baseChatReplaceAndSplit($.trim(characters[this_chid].description), name1, name2);
var charPersonality = baseChatReplaceAndSplit($.trim(characters[this_chid].personality), name1, name2); var charPersonality = baseChatReplaceAndSplit($.trim(characters[this_chid].personality), name1, name2);
var Scenario = baseChatReplaceAndSplit($.trim(characters[this_chid].scenario), name1, name2); var Scenario = baseChatReplaceAndSplit($.trim(characters[this_chid].scenario), name1, name2);
var mesExamples = baseChatReplaceAndSplit($.trim(characters[this_chid].mes_example.replace(/<START>/gi, '')), name1, name2); var mesExamples = baseChatReplaceAndSplit($.trim(characters[this_chid].mes_example.replace(/<START>/gi, '')), name1, name2);
let blocks = mesExamples.split(/<START>/gi);
let mesExamplesArray = blocks.slice(1).map(block => `<START>\n${block.trim()}\n`).join('');
function baseChatReplaceAndSplit(value, name1, name2) { function baseChatReplaceAndSplit(value, name1, name2) {
if (value !== undefined && value.length > 0) { if (value !== undefined && value.length > 0) {
if (is_pygmalion) { if (is_pygmalion) {
@@ -1059,8 +1061,6 @@ async function Generate(type, automatic_trigger) {
value = value.replace(/{{char}}/gi, name2); value = value.replace(/{{char}}/gi, name2);
value = value.replace(/<USER>/gi, name1); value = value.replace(/<USER>/gi, name1);
value = value.replace(/<BOT>/gi, name2); value = value.replace(/<BOT>/gi, name2);
let blocks = value.split(/<START>/gi);
return blocks.slice(1).map(block => `<START>\n${block.trim()}\n`).join('');
} }
return value; return value;
} }
@@ -2798,6 +2798,30 @@ function read_bg_load(input) {
} }
} }
function showSwipeButtons() {
if (
chat[chat.length - 1].name === 'TavernAI' ||
!swipes ||
$('.mes:last').attr('mesid') <= 0 ||
chat[chat.length - 1].is_user ||
count_view_mes <= 1
) { return; }
const currentMessage = $("#chat").children().filter(`[mesid="${count_view_mes - 1}"]`);
const swipeId = chat[chat.length - 1].swipe_id;
if (swipeId !== undefined && swipeId != 0) {
currentMessage.children('.swipe_left').css('display', 'flex');
}
currentMessage.children('.swipe_right').css('display', 'flex');
}
function hideSwipeButtons() {
//console.log('hideswipebuttons entered');
$("#chat").children().filter('[mesid="' + (count_view_mes - 1) + '"]').children('.swipe_right').css('display', 'none');
$("#chat").children().filter('[mesid="' + (count_view_mes - 1) + '"]').children('.swipe_left').css('display', 'none');
}
window["TavernAI"].getContext = function () { window["TavernAI"].getContext = function () {
return { return {
chat: chat, chat: chat,