mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Cleanup again
This commit is contained in:
@@ -872,11 +872,12 @@ async function getCharacters() {
|
|||||||
if (this_chid != undefined && this_chid != "invalid-safety-id") {
|
if (this_chid != undefined && this_chid != "invalid-safety-id") {
|
||||||
$("#avatar_url_pole").val(characters[this_chid].avatar);
|
$("#avatar_url_pole").val(characters[this_chid].avatar);
|
||||||
}
|
}
|
||||||
console.log(characters);
|
|
||||||
await getGroups();
|
await getGroups();
|
||||||
await printCharacters();
|
await printCharacters();
|
||||||
await AA_CountCharTime(this_chid);
|
await AA_CountCharTime(this_chid);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3424,7 +3425,7 @@ function saveReply(type, getMessage, this_mes_is_name, title) {
|
|||||||
chat[chat.length - 1]['is_user'])) {
|
chat[chat.length - 1]['is_user'])) {
|
||||||
type = 'normal';
|
type = 'normal';
|
||||||
}
|
}
|
||||||
|
console.log(chat);
|
||||||
const generationFinished = new Date();
|
const generationFinished = new Date();
|
||||||
const img = extractImageFromMessage(getMessage);
|
const img = extractImageFromMessage(getMessage);
|
||||||
getMessage = img.getMessage;
|
getMessage = img.getMessage;
|
||||||
@@ -3844,17 +3845,14 @@ async function getChat() {
|
|||||||
chat.push(...response);
|
chat.push(...response);
|
||||||
chat_create_date = chat[0]['create_date'];
|
chat_create_date = chat[0]['create_date'];
|
||||||
chat_metadata = chat[0]['chat_metadata'] ?? {};
|
chat_metadata = chat[0]['chat_metadata'] ?? {};
|
||||||
console.log(chat_metadata);
|
|
||||||
chat.shift();
|
chat.shift();
|
||||||
} else {
|
} else {
|
||||||
chat_create_date = humanizedDateTime();
|
chat_create_date = humanizedDateTime();
|
||||||
}
|
}
|
||||||
await getChatResult();
|
await getChatResult();
|
||||||
await saveChat();
|
await saveChat();
|
||||||
console.log('Chat loaded');
|
|
||||||
//loop through chats and get both chat[messageId]['gen_started'] and chat[messageId]['gen_finished']
|
|
||||||
//add up the difference of all of them and print it in seconds
|
|
||||||
let totalTime = 0;
|
|
||||||
|
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
$('#send_textarea').click();
|
$('#send_textarea').click();
|
||||||
|
|||||||
@@ -146,9 +146,17 @@ export function AA_CountCharTime(chid){
|
|||||||
if (chid !== undefined && chid !== "invalid-safety-id") { // if we are counting a valid pre-saved char
|
if (chid !== undefined && chid !== "invalid-safety-id") { // if we are counting a valid pre-saved char
|
||||||
let selected_character = characters[chid];
|
let selected_character = characters[chid];
|
||||||
let timeStirng = humanizeGenTime(selected_character);
|
let timeStirng = humanizeGenTime(selected_character);
|
||||||
|
//get total word counts
|
||||||
|
let user_words = selected_character.user_word_count;
|
||||||
|
let char_words = selected_character.word_count;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
console.log("Time spent generating: " + timeStirng)
|
console.log("Time spent generating: " + timeStirng)
|
||||||
//append to #result_info html
|
//append to #result_info html
|
||||||
$("#result_info").append(`<div class="result_info_item"><span class="result_info_item_title"></span><small class="result_info_item_value">${timeStirng}</small></div>`);
|
$("#result_info").append(`<div class="result_info_item"><span class="result_info_item_title"></span><small class="result_info_item_value">Chat time: ${timeStirng}</small></div>`);
|
||||||
|
$("#result_info").append(`<div class="result_info_item"><span class="result_info_item_title"></span><small class="result_info_item_value">Total words: ${user_words} / ${char_words}</small></div>`);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -317,7 +325,7 @@ export function RA_CountCharTokens() {
|
|||||||
// if neither, probably safety char or some error in loading
|
// if neither, probably safety char or some error in loading
|
||||||
} else { console.debug("RA_TC -- no valid char found, closing."); }
|
} else { console.debug("RA_TC -- no valid char found, closing."); }
|
||||||
}
|
}
|
||||||
$("#result_info").html(`<small>${count_tokens} Tokens dumb (${perm_tokens} Permanent)</small>`);
|
$("#result_info").html(`<small>${count_tokens} Tokens (${perm_tokens} Permanent)</small>`);
|
||||||
// display the counted tokens
|
// display the counted tokens
|
||||||
const tokenLimit = Math.max(((main_api !== 'openai' ? max_context : oai_settings.openai_max_context) / 2), 1024);
|
const tokenLimit = Math.max(((main_api !== 'openai' ? max_context : oai_settings.openai_max_context) / 2), 1024);
|
||||||
if (count_tokens < tokenLimit && perm_tokens < tokenLimit) {
|
if (count_tokens < tokenLimit && perm_tokens < tokenLimit) {
|
||||||
|
|||||||
@@ -654,7 +654,6 @@ function loadPowerUserSettings(settings, data) {
|
|||||||
switchWaifuMode();
|
switchWaifuMode();
|
||||||
loadMovingUIState();
|
loadMovingUIState();
|
||||||
|
|
||||||
console.log(power_user);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadMovingUIState() {
|
function loadMovingUIState() {
|
||||||
@@ -831,8 +830,6 @@ const compareFunc = (first, second) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function sortCharactersList() {
|
function sortCharactersList() {
|
||||||
console.log(characters);
|
|
||||||
console.log(getContext());
|
|
||||||
const arr1 = groups.map(x => ({
|
const arr1 = groups.map(x => ({
|
||||||
item: x,
|
item: x,
|
||||||
id: x.id,
|
id: x.id,
|
||||||
|
|||||||
Reference in New Issue
Block a user