From 47652d7fe9226bd7526d12b0498ac03c181b4fc1 Mon Sep 17 00:00:00 2001 From: Wolfsblvt Date: Tue, 8 Apr 2025 21:16:11 +0200 Subject: [PATCH] Prevent similarily-ish chat name renames --- public/script.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/public/script.js b/public/script.js index b57dad454..759a7462b 100644 --- a/public/script.js +++ b/public/script.js @@ -173,6 +173,7 @@ import { escapeHtml, saveBase64AsFile, uuidv4, + equalsIgnoreCaseAndAccents, } from './scripts/utils.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`, }; + if (equalsIgnoreCaseAndAccents(body.original_file, body.renamed_file)) { + console.warn('Chat name is the same (ignoring case and accents)'); + return; + } + try { showLoader(); const response = await fetch('/api/chats/rename', {