mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Fix first chat date injestion (I'm pretty sure).
This commit is contained in:
@@ -110,7 +110,7 @@ function createHtml(statsType, stats) {
|
||||
if (statsType === "User") {
|
||||
html += createStatBlock("Chatting Since", `${chatAge} ago`);
|
||||
} else {
|
||||
html += createStatBlock("Chat Age", chatAge);
|
||||
html += createStatBlock("First Interaction", `${chatAge} ago`);
|
||||
}
|
||||
html += createStatBlock("Chat Time", timeStirng);
|
||||
html += createStatBlock("User Messages", stats.user_msg_count);
|
||||
@@ -284,11 +284,11 @@ async function statMesProcess(line, type, characters, this_chid, oldMesssage) {
|
||||
stat.total_swipe_count++;
|
||||
}
|
||||
stat.date_last_chat = Date.now();
|
||||
stat.first_chat_time = Math.min(
|
||||
stat.date_first_chat = Math.min(
|
||||
stat.date_first_chat ?? new Date("9999-12-31T23:59:59.999Z").getTime(),
|
||||
Date.now()
|
||||
);
|
||||
updateStats();
|
||||
}
|
||||
|
||||
export { userStatsHandler, characterStatsHandler, getStats, statMesProcess };
|
||||
export { userStatsHandler, characterStatsHandler, getStats, statMesProcess, charStats };
|
||||
|
@@ -393,8 +393,9 @@ function calculateTotalGenTimeAndWordCount(
|
||||
}
|
||||
|
||||
// If this is the first user message, set the first chat time
|
||||
if (json.is_user && firstChatTime > Date.now()) {
|
||||
firstChatTime = timestampToMoment(json.send_date);
|
||||
if (json.is_user) {
|
||||
//get min between firstChatTime and timestampToMoment(json.send_date)
|
||||
firstChatTime = Math.min(timestampToMoment(json.send_date), firstChatTime);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`Error parsing line ${line}: ${error}`);
|
||||
|
Reference in New Issue
Block a user