Prevent similarily-ish chat name renames

This commit is contained in:
Wolfsblvt
2025-04-08 21:16:11 +02:00
parent 55ed5b325c
commit 47652d7fe9

View File

@ -173,6 +173,7 @@ import {
escapeHtml, escapeHtml,
saveBase64AsFile, saveBase64AsFile,
uuidv4, uuidv4,
equalsIgnoreCaseAndAccents,
} from './scripts/utils.js'; } from './scripts/utils.js';
import { debounce_timeout, IGNORE_SYMBOL } from './scripts/constants.js'; import { debounce_timeout, IGNORE_SYMBOL } from './scripts/constants.js';
@ -9878,6 +9879,11 @@ export async function renameChat(oldFileName, newName) {
renamed_file: `${newName.trim()}.jsonl`, renamed_file: `${newName.trim()}.jsonl`,
}; };
if (equalsIgnoreCaseAndAccents(body.original_file, body.renamed_file)) {
console.warn('Chat name is the same (ignoring case and accents)');
return;
}
try { try {
showLoader(); showLoader();
const response = await fetch('/api/chats/rename', { const response = await fetch('/api/chats/rename', {