mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Merge pull request #3561 from SillyTavern/fix-syncing-swipe-data
Fix syncing swipe data on reasoning parse & utility function to sync swipe data
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
moment,
|
||||
} from '../lib.js';
|
||||
import { chat, closeMessageEditor, event_types, eventSource, main_api, messageFormatting, saveChatConditional, saveChatDebounced, saveSettingsDebounced, substituteParams, updateMessageBlock } from '../script.js';
|
||||
import { chat, closeMessageEditor, event_types, eventSource, main_api, messageFormatting, saveChatConditional, saveChatDebounced, saveSettingsDebounced, substituteParams, syncMesToSwipe, updateMessageBlock } from '../script.js';
|
||||
import { getRegexedString, regex_placement } from './extensions/regex/engine.js';
|
||||
import { getCurrentLocale, t, translate } from './i18n.js';
|
||||
import { MacrosParser } from './macros.js';
|
||||
@@ -1046,8 +1046,11 @@ function registerReasoningAppEvents() {
|
||||
message.mes = parsedReasoning.content;
|
||||
}
|
||||
|
||||
// Find if a message already exists in DOM and must be updated
|
||||
if (contentUpdated) {
|
||||
syncMesToSwipe();
|
||||
saveChatDebounced();
|
||||
|
||||
// Find if a message already exists in DOM and must be updated
|
||||
const messageRendered = document.querySelector(`.mes[mesid="${idx}"]`) !== null;
|
||||
if (messageRendered) {
|
||||
console.debug('[Reasoning] Updating message block', idx);
|
||||
|
@@ -42,7 +42,7 @@ import {
|
||||
showMoreMessages,
|
||||
stopGeneration,
|
||||
substituteParams,
|
||||
syncCurrentSwipeInfoExtras,
|
||||
syncMesToSwipe,
|
||||
system_avatar,
|
||||
system_message_types,
|
||||
this_chid,
|
||||
@@ -2921,7 +2921,7 @@ async function addSwipeCallback(args, value) {
|
||||
|
||||
if (isTrueBoolean(args.switch)) {
|
||||
// Make sure ad-hoc changes to extras are saved before swiping away
|
||||
syncCurrentSwipeInfoExtras();
|
||||
syncMesToSwipe();
|
||||
lastMessage.swipe_id = newSwipeId;
|
||||
lastMessage.mes = lastMessage.swipes[newSwipeId];
|
||||
lastMessage.extra = structuredClone(lastMessage.swipe_info?.[newSwipeId]?.extra ?? lastMessage.extra ?? {});
|
||||
|
Reference in New Issue
Block a user