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 {
173 escapeHtml,173 escapeHtml,
174 saveBase64AsFile,174 saveBase64AsFile,
175 uuidv4,175 uuidv4,
176 equalsIgnoreCaseAndAccents,
176} from './scripts/utils.js';177} from './scripts/utils.js';
177import { debounce_timeout, IGNORE_SYMBOL } from './scripts/constants.js';178import { debounce_timeout, IGNORE_SYMBOL } from './scripts/constants.js';
178179
@@ -9878,6 +9879,11 @@ export async function renameChat(oldFileName, newName) {
9878 renamed_file: `${newName.trim()}.jsonl`,9879 renamed_file: `${newName.trim()}.jsonl`,
9879 };9880 };
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
9881 try {9887 try {
9882 showLoader();9888 showLoader();
9883 const response = await fetch('/api/chats/rename', {9889 const response = await fetch('/api/chats/rename', {