mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Cancel debounced chat save if regular save is performed
This commit is contained in:
@ -6436,6 +6436,7 @@ export function saveChatDebounced() {
|
||||
if (chatSaveTimeout) {
|
||||
console.debug('Clearing chat save timeout');
|
||||
clearTimeout(chatSaveTimeout);
|
||||
chatSaveTimeout = null;
|
||||
}
|
||||
|
||||
chatSaveTimeout = setTimeout(async () => {
|
||||
@ -6452,7 +6453,7 @@ export function saveChatDebounced() {
|
||||
console.debug('Chat save timeout triggered');
|
||||
await saveChatConditional();
|
||||
console.debug('Chat saved');
|
||||
}, 1000);
|
||||
}, DEFAULT_SAVE_EDIT_TIMEOUT);
|
||||
}
|
||||
|
||||
export async function saveChat(chatName, withMetadata, mesId) {
|
||||
@ -8067,6 +8068,12 @@ export async function saveChatConditional() {
|
||||
}
|
||||
|
||||
try {
|
||||
if (chatSaveTimeout) {
|
||||
console.debug('Debounced chat save canceled');
|
||||
clearTimeout(chatSaveTimeout);
|
||||
chatSaveTimeout = null;
|
||||
}
|
||||
|
||||
isChatSaving = true;
|
||||
|
||||
if (selected_group) {
|
||||
|
@ -1048,7 +1048,7 @@ function registerReasoningAppEvents() {
|
||||
|
||||
if (contentUpdated) {
|
||||
syncMesToSwipe();
|
||||
await saveChatConditional();
|
||||
saveChatDebounced();
|
||||
|
||||
// Find if a message already exists in DOM and must be updated
|
||||
const messageRendered = document.querySelector(`.mes[mesid="${idx}"]`) !== null;
|
||||
|
Reference in New Issue
Block a user