mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-03-10 03:37:33 +08:00
Allow api_base override
Provide a means for local development to specify the api_base to override assumption that the api is where the client is based on browser 'location'
This commit is contained in:
parent
d19de2753e
commit
f73bf1cffd
3
.gitignore
vendored
3
.gitignore
vendored
@ -14,4 +14,5 @@ venv/
|
||||
/web/extensions/*
|
||||
!/web/extensions/logging.js.example
|
||||
!/web/extensions/core/
|
||||
/tests-ui/data/object_info.json
|
||||
/tests-ui/data/object_info.json
|
||||
.vscode
|
||||
@ -7,6 +7,10 @@ class ComfyApi extends EventTarget {
|
||||
this.api_base = location.pathname.split('/').slice(0, -1).join('/');
|
||||
}
|
||||
|
||||
set apiBase(apiBase) {
|
||||
this.api_base = apiBase;
|
||||
}
|
||||
|
||||
apiURL(route) {
|
||||
return this.api_base + route;
|
||||
}
|
||||
@ -314,7 +318,7 @@ class ComfyApi extends EventTarget {
|
||||
*/
|
||||
async interrupt() {
|
||||
await this.#postItem("interrupt", null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const api = new ComfyApi();
|
||||
|
||||
@ -78,6 +78,14 @@ export class ComfyApp {
|
||||
this.shiftDown = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide a setter for the base url of the api
|
||||
* @param {string} apiBase
|
||||
*/
|
||||
set apiBase(apiBase) {
|
||||
api.apiBase = apiBase;
|
||||
}
|
||||
|
||||
getPreviewFormatParam() {
|
||||
let preview_format = this.ui.settings.getSettingValue("Comfy.PreviewFormat");
|
||||
if(preview_format)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user