Prevent similarily-ish world info renames Adds validation to block renaming world info entries when new name matches existing name after ignoring case and accents This avoids unnecessary operations and potential data duplication issues caused by superficial name changes that don't meaningfully differ in normalized form

6895892d5a9e473c135a3985570ceb144e248e9f

Wolfsblvt <wolfsblvt@gmail.com>

1 files changed, +5 -1Ignore whitespace
public/scripts/world-info.js+5 -1
@@ -1,7 +1,7 @@
11import { Fuse } from '../lib.js';
22
33import { saveSettings, substituteParams, getRequestHeaders, chat_metadata, this_chid, characters, saveCharacterDebounced, menu_type, eventSource, event_types, getExtensionPromptByName, saveMetadata, getCurrentChatId, extension_prompt_roles } from '../script.js';
44import { download, debounce, initScrollHeight, resetScrollHeight, parseJsonFile, extractDataFromPng, getFileBuffer, getCharaFilename, getSortableDelay, escapeRegex, PAGINATION_TEMPLATE, navigation_option, waitUntilCondition, isTrueBoolean, setValueByPath, flashHighlight, select2ModifyOptions, getSelect2OptionId, dynamicSelect2DataViaAjax, highlightRegex, select2ChoiceClickSubscribe, isFalseBoolean, getSanitizedFilename, checkOverwriteExistingData, getStringHash, parseStringArray, cancelDebounce, findChar, onlyUnique, equalsIgnoreCaseAndAccents } from './utils.js';
55import { extension_settings, getContext } from './extensions.js';
66import { NOTE_MODULE_NAME, metadata_keys, shouldWIAddPrompt } from './authors-note.js';
77import { isMobile } from './RossAscends-mods.js';
@@ -3586,6 +3586,10 @@ async function renameWorldInfo(name, data) {
35863586 console.debug('World info rename cancelled');
35873587 return;
35883588 }
3589+ if (equalsIgnoreCaseAndAccents(oldName, newName)) {
3590+ console.warn('World info name is the same (ignoring case and accents)');
3591+ return;
3592+ }
35893593
35903594 const entryPreviouslySelected = selected_world_info.findIndex((e) => e === oldName);
35913595