diff --git a/web-plugin/index.js b/web-plugin/index.js index cc2b758..63d3b04 100644 --- a/web-plugin/index.js +++ b/web-plugin/index.js @@ -880,7 +880,10 @@ export class ConfigDialog extends ComfyDialog { justifyContent: "flex-end", width: "100%", }, - onclick: () => this.save(), + onclick: () => { + this.save(); + this.close(); + }, }, [ $el("button", { @@ -891,7 +894,10 @@ export class ConfigDialog extends ComfyDialog { $el("button", { type: "button", textContent: "Save", - onclick: () => this.save(), + onclick: () => { + this.save(); + this.close(); + }, }), ], ), @@ -905,20 +911,26 @@ export class ConfigDialog extends ComfyDialog { } save(api_key, displayName) { - if (!displayName) displayName = getData().displayName; - const deployOption = this.container.querySelector("#deployOption").value; localStorage.setItem("comfy_deploy_env", deployOption); const endpoint = this.container.querySelector("#endpoint").value; const apiKey = api_key ?? this.container.querySelector("#apiKey").value; + + if (!displayName) { + if (apiKey != getData().apiKey) { + displayName = "Custom"; + } else { + displayName = getData().displayName; + } + } + saveData({ endpoint, apiKey, displayName, environment: deployOption, }); - this.close(); } show() { @@ -941,7 +953,7 @@ export class ConfigDialog extends ComfyDialog { data.endpoint }"> -