fixed mistake with function locations, working now.

This commit is contained in:
RossAsscends
2023-03-17 17:52:35 +09:00
parent 10a4d39c7e
commit 420fb5ef17
4 changed files with 406 additions and 354 deletions

View File

@@ -1,2 +0,0 @@
{"user_name":"You","character_name":"Aqua","create_date":1674559896839}
{"name":"Aqua","is_user":false,"is_name":true,"send_date":1674563371558,"mes":"*I am in the town square at a city named \"Axel\". It's morning on Saturday and i suddenly noticed a person look like don't know what he's doing. I approached to him and speak* Are you new here? Do you need help? Don't worry, I, aqua the goddess of water, shall help you! Do i look beautiful? *strikes a pose and look at him with puppy eyes*"}

View File

@@ -1,2 +0,0 @@
{"user_name":"You","character_name":"Darkness","create_date":1674559899431}
{"name":"Darkness","is_user":false,"is_name":true,"send_date":1674564914912,"mes":"*It's a sunny day, in a big park on which there are many people, some walking and others lying in the sun. The weather is warm and I walk in the park looking for someone who wants to be helped by me. Suddenly realise that someone is looking at me.* Hello, I am Darkness, a Crusader, and would you like some help?"}

View File

@@ -1,2 +0,0 @@
{"user_name":"You","character_name":"Megumin","create_date":1674559900991}
{"name":"Megumin","is_user":false,"is_name":true,"send_date":1674563153854,"mes":"*It was day, the weather was sunny and windless. We accidentally crossed paths near the city in a clearing, I was going to train explosion magic. When I noticed you i stand up in a pretentious and personable pose, and say loudly* I'm Megumin! The Arch Wizard of the Crimson Magic Clan! And i the best at explosion magic!! What are you doing here?"}

View File

@@ -1,4 +1,5 @@
import { humanizedDateTime } from "./scripts/RossAscends-mods.js";
import { encode, decode } from "../scripts/gpt-2-3-tokenizer/mod.js";
//RossAscends: exporting functions and vars for RA mods.
export {
@@ -648,7 +649,23 @@ var token;
}
}
async function setBackground(bg) {
/*
const response = await fetch("/setbackground", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"bg": bg
})
});
if (response.ok === true) {
//const getData = await response.json();
//background = getData;
//var aa = JSON.parse(getData[0]);
//const load_ch_coint = Object.getOwnPropertyNames(getData);
}*/
//console.log(bg);
jQuery.ajax({
type: 'POST', //
url: '/setbackground', //
@@ -663,6 +680,9 @@ var token;
contentType: "application/json",
//processData: false,
success: function (html) {
//setBackground(html);
//$('body').css('background-image', 'linear-gradient(rgba(19,21,44,0.75), rgba(19,21,44,0.75)), url('+e.target.result+')');
//$("#form_bg_download").after("<div class=bg_example><img bgfile='"+html+"' class=bg_example_img src='backgrounds/"+html+"'><img bgfile='"+html+"' class=bg_example_cross src=img/cross.png></div>");
},
error: function (jqXHR, exception) {
console.log(exception);
@@ -683,10 +703,20 @@ var token;
});
if (response.ok === true) {
//const getData = await response.json();
//background = getData;
//var aa = JSON.parse(getData[0]);
//const load_ch_coint = Object.getOwnPropertyNames(getData);
}
}
function printMessages() {
//console.log(chat);
//console.log('printMessages() -- printing messages for -- '+this_chid+' '+active_character+' '+characters[this_chid]);
chat.forEach(function (item, i, arr) {
//console.log('printMessage calls addOneMessage');
addOneMessage(item);
});
}
@@ -797,30 +827,57 @@ var token;
if (isSystem) {
newMessage.find('.mes_edit').hide();
}
//////// swipecode inside addOneMessage - to keep swipes displayed while
// SWIPE BUTTON DISPLAY SHOULD BE HANDLED IN showSwipeButtons/hideSwipeButtons, not here. Commented out duplicate code.
if (type === "swipe") {
$("#chat")
.children()
.filter('[mesid="' + (count_view_mes - 1) + '"]')
.children(".mes_block")
.children(".mes_text")
.html("");
$("#chat")
.children()
.filter('[mesid="' + (count_view_mes - 1) + '"]')
.children(".mes_block")
.children(".mes_text")
.append(messageText);
//console.log('addOneMessage -- type = '+type);
if(type === 'swipe'){
//console.log('addOneMessage -- detected adding one swipe message')
$("#chat").children().filter('[mesid="'+(count_view_mes-1)+'"]').children('.mes_block').children('.mes_text').html('');
$("#chat").children().filter('[mesid="'+(count_view_mes-1)+'"]').children('.mes_block').children('.mes_text').append(messageText);
/* if(mes['swipe_id'] !== 0 && swipes){
console.log('addOneMessage -- swipe_id is not 0, adding both buttons');
$("#chat").children().filter('[mesid="'+(count_view_mes-1)+'"]').children('.swipe_right').css('display', 'flex');
$("#chat").children().filter('[mesid="'+(count_view_mes-1)+'"]').children('.swipe_left').css('display', 'flex');
} */
}else{ //if this is not a display of a new swipe message..
//console.log('addOneMessage -- adding message');
$("#chat").children().filter('[mesid="'+count_view_mes+'"]').children('.mes_block').children('.mes_text').append(messageText);
//console.log('addOneMessage - hiding swipe buttons');
hideSwipeButtons(); //disabling this leaves buttons visibile on all messages, breaks swipes
//console.log('addOneMessage -- checking for swipes');
/* if(parseInt(chat.length-1) === parseInt(count_view_mes) && !mes['is_user'] && swipes){
console.log('chat length - 1 = '+(chat[chat.length-1]['mesid']));
if(chat[chat.length-1]['mesid'] !==undefined){
if(mes['swipe_id'] === undefined && count_view_mes !== 0){
console.log('addOneMessage -- no swipes here, showing right button for possible generation');
$("#chat").children().filter('[mesid="'+(count_view_mes)+'"]').children('.swipe_right').css('display', 'flex');
}else if(mes['swipe_id'] !== undefined){ // if swipes aren't undefined == swipes exist at this node
console.log('addOneMessage -- found swipes')
if(mes['swipe_id'] === 0){ //if we are viewing the first swipe message, display right
console.log('addOneMessage -- found lone swipe, displaying right button');
$("#chat").children().filter('[mesid="'+(count_view_mes)+'"]').children('.swipe_right').css('display', 'flex');
}else { // if swipe_id is more than 0, than means we must have multiple swipes, so show both items
console.log('addOneMessage -- found multiple swipes, showing both buttons');
$("#chat").children().filter('[mesid="'+(count_view_mes)+'"]').children('.swipe_right').css('display', 'flex');
$("#chat").children().filter('[mesid="'+(count_view_mes)+'"]').children('.swipe_left').css('display', 'flex');
}
}
}
}else{console.log('apparently no swipes found, and not a valid mesage to add hideSwipeButtons, so skipping');} */
count_view_mes++;
}
/* } */
// if(type !== 'swipe'){count_view_mes++;}
var $textchat = $("#chat");
$("#chat .mes").last().addClass("last_mes");
$("#chat .mes").eq(-2).removeClass("last_mes");
var $textchat = $('#chat');
$('#chat .mes').last().addClass('last_mes');
$('#chat .mes').eq(-2).removeClass('last_mes');
$textchat.scrollTop($textchat[0].scrollHeight);
hideSwipeButtons();
hideSwipeButtons(); //disabling this prevents left button from correctly removing on last message without swipe to the left...
showSwipeButtons();
}
@@ -3039,6 +3096,7 @@ console.log('getGroupChat calls addOneMessage');
a.download = fileName;
a.click();
}
// World Info Editor
async function showWorldEditor() {
if (!world_info) {
@@ -3390,7 +3448,7 @@ console.log('getGroupChat calls addOneMessage');
/////////////////////////////////////////////////////////
import { encode, decode } from "../scripts/gpt-2-3-tokenizer/mod.js";
$(document).ready(function () {
$('#swipes-checkbox').change(function() {