From 3a0b4ec41dcd48eea8db92b6ee28e4b3c9495e46 Mon Sep 17 00:00:00 2001
From: Cohee <18619528+Cohee1207@users.noreply.github.com>
Date: Fri, 12 Jul 2024 21:14:36 +0300
Subject: [PATCH] Update popup usage
---
public/scripts/openai.js | 12 +++++-------
public/scripts/popup.js | 2 +-
2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/public/scripts/openai.js b/public/scripts/openai.js
index 2886778e3..e2402c095 100644
--- a/public/scripts/openai.js
+++ b/public/scripts/openai.js
@@ -73,7 +73,7 @@ import { SlashCommand } from './slash-commands/SlashCommand.js';
import { ARGUMENT_TYPE, SlashCommandArgument } from './slash-commands/SlashCommandArgument.js';
import { renderTemplateAsync } from './templates.js';
import { SlashCommandEnumValue } from './slash-commands/SlashCommandEnumValue.js';
-import { Popup, POPUP_RESULT, POPUP_TYPE, PopupUtils } from './popup.js';
+import { Popup, POPUP_RESULT } from './popup.js';
export {
openai_messages_count,
@@ -3525,10 +3525,9 @@ async function onPresetImportFileChange(e) {
if (shouldConfirm) {
const textHeader = 'The imported preset contains proxy and/or custom endpoint settings.';
const textMessage = fields.join('
');
- const cancelButton = { text: 'Cancel import', result: POPUP_RESULT.CANCELLED, appendAtEnd: true, action: () => popup.complete(POPUP_RESULT.CANCELLED) };
+ const cancelButton = { text: 'Cancel import', result: POPUP_RESULT.CANCELLED, appendAtEnd: true };
const popupOptions = { customButtons: [cancelButton], okButton: 'Remove them', cancelButton: 'Import as-is' };
- const popup = new Popup(PopupUtils.BuildTextWithHeader(textHeader, textMessage), POPUP_TYPE.CONFIRM, '', popupOptions);
- const popupResult = await popup.show();
+ const popupResult = await Popup.show.confirm(textHeader, textMessage, popupOptions);
if (popupResult === POPUP_RESULT.CANCELLED) {
console.log('Import cancelled by user');
@@ -3590,10 +3589,9 @@ async function onExportPresetClick() {
const shouldConfirm = fieldValues.length > 0;
const textHeader = 'Your preset contains proxy and/or custom endpoint settings.';
const textMessage = `