From a56190cdb1ec469e3ef45061db858804357eba39 Mon Sep 17 00:00:00 2001 From: w-e-w <40751091+w-e-w@users.noreply.github.com> Date: Tue, 24 Dec 2024 08:02:40 +0900 Subject: [PATCH 1/2] API /sdapi/v1/server-reload-ui --- modules/api/api.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/api/api.py b/modules/api/api.py index db2fc648019..80fb177d824 100644 --- a/modules/api/api.py +++ b/modules/api/api.py @@ -249,6 +249,7 @@ def __init__(self, app: FastAPI, queue_lock: Lock): self.add_api_route("/sdapi/v1/server-kill", self.kill_webui, methods=["POST"]) self.add_api_route("/sdapi/v1/server-restart", self.restart_webui, methods=["POST"]) self.add_api_route("/sdapi/v1/server-stop", self.stop_webui, methods=["POST"]) + self.add_api_route("/sdapi/v1/server-reload-ui", self.reload_webui, methods=["POST"]) self.default_script_arg_txt2img = [] self.default_script_arg_img2img = [] @@ -926,3 +927,6 @@ def stop_webui(request): shared.state.server_command = "stop" return Response("Stopping.") + def reload_webui(self): + shared.state.request_restart() + return Response("Reloading.") From 60efbc4618f7ad2e0c5cb813bed3011af7a05e43 Mon Sep 17 00:00:00 2001 From: w-e-w <40751091+w-e-w@users.noreply.github.com> Date: Tue, 24 Dec 2024 08:22:43 +0900 Subject: [PATCH 2/2] API /sdapi/v1/server-reload-script-bodies --- modules/api/api.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/api/api.py b/modules/api/api.py index 80fb177d824..75c481e9710 100644 --- a/modules/api/api.py +++ b/modules/api/api.py @@ -250,6 +250,7 @@ def __init__(self, app: FastAPI, queue_lock: Lock): self.add_api_route("/sdapi/v1/server-restart", self.restart_webui, methods=["POST"]) self.add_api_route("/sdapi/v1/server-stop", self.stop_webui, methods=["POST"]) self.add_api_route("/sdapi/v1/server-reload-ui", self.reload_webui, methods=["POST"]) + self.add_api_route("/sdapi/v1/server-reload-script-bodies", self.reload_script_bodies, methods=["POST"]) self.default_script_arg_txt2img = [] self.default_script_arg_img2img = [] @@ -930,3 +931,7 @@ def stop_webui(request): def reload_webui(self): shared.state.request_restart() return Response("Reloading.") + + def reload_script_bodies(self): + scripts.reload_script_body_only() + return Response("Reload script bodies.")