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