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