Prevent similarily-ish chat name renames

47652d7fe9226bd7526d12b0498ac03c181b4fc1

Wolfsblvt <wolfsblvt@gmail.com>

1 files changed, +6 -0Showing whitespace changes
public/script.js+6 -0
@@ -173,6 +173,7 @@ import {
173173 escapeHtml,
174174 saveBase64AsFile,
175175 uuidv4,
176+ equalsIgnoreCaseAndAccents,
176177} from './scripts/utils.js';
177178import { debounce_timeout, IGNORE_SYMBOL } from './scripts/constants.js';
178179
@@ -9878,6 +9879,11 @@ export async function renameChat(oldFileName, newName) {
98789879 renamed_file: `${newName.trim()}.jsonl`,
98799880 };
98809881
9882+ if (equalsIgnoreCaseAndAccents(body.original_file, body.renamed_file)) {
9883+ console.warn('Chat name is the same (ignoring case and accents)');
9884+ return;
9885+ }
9886+
98819887 try {
98829888 showLoader();
98839889 const response = await fetch('/api/chats/rename', {