diff --git a/example/example.png b/example/example.png index 7b481bd..f3f6943 100644 Binary files a/example/example.png and b/example/example.png differ diff --git a/static/js/dialog.js b/static/js/dialog.js index 03d0a8e..b992103 100644 --- a/static/js/dialog.js +++ b/static/js/dialog.js @@ -93,6 +93,7 @@ export class EasyApiDialog extends ComfyDialog { // 设置元素的新位置: mainEl.style.top = (mainEl.offsetTop - offset_y) + "px"; mainEl.style.left = (mainEl.offsetLeft - offset_x) + "px"; + mainEl.style.width = mainEl.keepWidth + "px"; } function closeDragElement() { @@ -109,8 +110,9 @@ export class EasyApiDialog extends ComfyDialog { save() { this.saveCb && this.saveCb(this); } - showSaveBtn() { + showSaveBtn(saveBtnLabel="Update") { let saveBtn = this.element.getElementsByClassName("easyapi-dialog-save")[0] + saveBtn.innerHTML = saveBtnLabel; saveBtn.style.display = ""; } hideSaveBtn() { @@ -118,7 +120,7 @@ export class EasyApiDialog extends ComfyDialog { saveBtn.style.display = "none"; } - show(html, showSave, saveCb) { + show(html, showSave, saveCb, saveBtnLabel="Update") { if (typeof html === "string") { this.textElement.innerHTML = html; } else { @@ -126,11 +128,12 @@ export class EasyApiDialog extends ComfyDialog { } this.showSave = showSave || false; if (this.showSave) { - this.showSaveBtn(); + this.showSaveBtn(saveBtnLabel); } else { this.hideSaveBtn(); } this.saveCb = saveCb - this.element.style.display = "flex"; + this.element.style.display = "flex"; + this.element.keepWidth = this.element.clientWidth; } } diff --git a/static/js/easyapi.js b/static/js/easyapi.js index 070d8a8..29a23fb 100644 --- a/static/js/easyapi.js +++ b/static/js/easyapi.js @@ -6,6 +6,11 @@ app.registerExtension({ name: "Comfy.EasyApi.Setting", async setup(app) { this.add_history_setting(app); + // plugins are loaded before the manager, cannot be patched with Python hooks on Windows. + const systemStats = await api.getSystemStats(); + if (systemStats.system.os !== 'nt') { + this.add_github_clone_mirror_setting(app); + } this.add_github_mirror_setting(app); this.add_rawgithub_mirror_setting(app); this.add_huggingface_mirror_setting(app); @@ -67,6 +72,70 @@ app.registerExtension({ } }); }, + add_github_clone_mirror_setting: function (app) { + const changeFun = debounce((n, o) => api.fetchApi("/easyapi/settings/clone_github_mirror", { + method: 'POST', + headers: { + "content-type": "application/json", + }, + body: JSON.stringify({ + clone_github_mirror: n + }) + }), 1000, false) + app.ui.settings.addSetting({ + id: "Easyapi.MirrorSet.github.clone", + name: "[EasyApi] Github Clone Mirror", + defaultValue: "None", + tooltip: "Will replace host github.com. Suitable of git clone from github.com. On Windows platforms, it is not valid for ComfyUI manager.", + type: "combo", + options: [ + { + value: "None", + text: "None" + }, + { + value: "hub.gitmirror.com/https://github.com", + text: "gitmirror.com" + }, + { + value: "mirror.ghproxy.com/https://github.com", + text: "mirror.ghproxy.com" + }, + { + value: "ghproxy.net/https://github.com", + text: "ghproxy.net" + }, + { + value: "ghproxy.org/https://github.com", + text: "ghproxy.org" + }, + { + value: "gh-proxy.com/https://github.com", + text: "gh-proxy.com" + }, + { + value: "gh.ddlc.top/https://github.com", + text: "gh.ddlc.top" + }, + { + value: "mirrors.chenby.cn/https://github.com", + text: "mirrors.chenby.cn" + }, + { + value: "521github.com/extdomains/github.com", + text: "521github.com" + }, + { + value: "github.moeyy.xyz/https://github.com", + text: "github.moeyy.xyz" + } + ], + + onChange: (newVal, oldVal) => { + changeFun.apply(null, [newVal, oldVal]) + } + }); + }, add_github_mirror_setting: function (app) { const changeFun = debounce((n, o) => api.fetchApi("/easyapi/settings/github_mirror", { method: 'POST', @@ -81,7 +150,7 @@ app.registerExtension({ id: "Easyapi.MirrorSet.github", name: "[EasyApi] Github Mirror", defaultValue: "None", - tooltip: "Will replace host github.com. Suitable of download some models from github.com.", + tooltip: "Will replace host github.com. Suitable of downloading some models from github.com.", type: "combo", options: [ { @@ -219,7 +288,11 @@ app.registerExtension({ { value: "hf-mirror.com", text: "hf-mirror.com" - } + }, + // { + // value: "gitee.com/hf-models", + // text: "gitee.com" + // } ], onChange: (newVal, oldVal) => { diff --git a/static/js/workflows.js b/static/js/workflows.js index 48d167b..58bd2db 100644 --- a/static/js/workflows.js +++ b/static/js/workflows.js @@ -247,6 +247,9 @@ class EasyApiWorkflows { [ $el("table", { + style: { + borderCollapse: "collapse" + }, $: (element) => { nodes.forEach((n, index) => { let line = @@ -543,7 +546,11 @@ class EasyApiWorkflows { {}, [ $el("table", - {}, + { + style: { + borderCollapse: "collapse" + }, + }, [ $el("tr", {}, @@ -658,6 +665,9 @@ class EasyApiWorkflows { $el("table", { id: "easyapi-repeat-id-nodes", + style: { + borderCollapse: "collapse" + }, $: (element) => listByNodeId(element, nodes, node, node.id) }, [] @@ -719,7 +729,7 @@ class EasyApiWorkflows { disabled: !hasOutputLink, has_submenu: hasOutputLink, submenu: { - options: node.outputs?.filter(output => output?.links) + options: node.outputs?.filter(output => output?.links?.length > 0) .map((output) => { return { content: `${output.name} - ${output.type}`,