Fix force flag not being passed

5fca39fae7621c0e4f85ee262c877b0b59cf692d

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +4 -2Ignore whitespace
public/script.js+4 -2
@@ -6695,7 +6695,7 @@ export function saveChatDebounced() {
6695 *6695 *
6696 * @returns {Promise<void>}6696 * @returns {Promise<void>}
6697 */6697 */
6698export async function saveChat({ chatName, withMetadata, mesId, force } = {}) {6698export async function saveChat({ chatName, withMetadata, mesId, force = false } = {}) {
6699 const metadata = { ...chat_metadata, ...(withMetadata || {}) };6699 const metadata = { ...chat_metadata, ...(withMetadata || {}) };
6700 const fileName = chatName ?? characters[this_chid]?.chat;6700 const fileName = chatName ?? characters[this_chid]?.chat;
67016701
@@ -6740,6 +6740,7 @@ export async function saveChat({ chatName, withMetadata, mesId, force } = {}) {
6740 file_name: fileName,6740 file_name: fileName,
6741 chat: chatToSave,6741 chat: chatToSave,
6742 avatar_url: characters[this_chid].avatar,6742 avatar_url: characters[this_chid].avatar,
6743 force: force,
6743 }),6744 }),
6744 cache: 'no-cache',6745 cache: 'no-cache',
6745 });6746 });
@@ -6748,8 +6749,9 @@ export async function saveChat({ chatName, withMetadata, mesId, force } = {}) {
6748 const errorData = await result.json();6749 const errorData = await result.json();
6749 if (errorData?.error === 'integrity' && !force) {6750 if (errorData?.error === 'integrity' && !force) {
6750 const forceSaveConfirmed = await Popup.show.confirm(6751 const forceSaveConfirmed = await Popup.show.confirm(
6751 t`Chat integrity check failed, operation may result in data loss.`,6752 t`Chat integrity check failed, continuing the operation may result in data loss.`,
6752 t`Would you like to overwrite the chat file anyway? Pressing "NO" will cancel the save operation.`,6753 t`Would you like to overwrite the chat file anyway? Pressing "NO" will cancel the save operation.`,
6754 { okButton: t`Yes, overwrite`, cancelButton: t`No, cancel` },
6753 ) === POPUP_RESULT.AFFIRMATIVE;6755 ) === POPUP_RESULT.AFFIRMATIVE;
67546756
6755 if (forceSaveConfirmed) {6757 if (forceSaveConfirmed) {