mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Prevent similarily-ish chat name renames
This commit is contained in:
@ -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', {
|
||||||
|
Reference in New Issue
Block a user