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
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | import { Fuse } from '../lib.js'; |
| 2 | 2 | |
| 3 | 3 | import { saveSettings, substituteParams, getRequestHeaders, chat_metadata, this_chid, characters, saveCharacterDebounced, menu_type, eventSource, event_types, getExtensionPromptByName, saveMetadata, getCurrentChatId, extension_prompt_roles } from '../script.js'; |
| 4 | 4 | import { 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'; |
| 5 | 5 | import { extension_settings, getContext } from './extensions.js'; |
| 6 | 6 | import { NOTE_MODULE_NAME, metadata_keys, shouldWIAddPrompt } from './authors-note.js'; |
| 7 | 7 | import { isMobile } from './RossAscends-mods.js'; |
| @@ -3586,6 +3586,10 @@ async function renameWorldInfo(name, data) { | ||
| 3586 | 3586 | console.debug('World info rename cancelled'); |
| 3587 | 3587 | return; |
| 3588 | 3588 | } |
| 3589 | + if (equalsIgnoreCaseAndAccents(oldName, newName)) { | |
| 3590 | + console.warn('World info name is the same (ignoring case and accents)'); | |
| 3591 | + return; | |
| 3592 | + } | |
| 3589 | 3593 | |
| 3590 | 3594 | const entryPreviouslySelected = selected_world_info.findIndex((e) => e === oldName); |
| 3591 | 3595 | |