Skip to content

Commit e2ea28e

Browse files
add mgmt api UI to ComfyStream menu in ComfyUI, some fixes/improvements
1 parent 607ab73 commit e2ea28e

File tree

6 files changed

+1257
-115
lines changed

6 files changed

+1257
-115
lines changed

nodes/api/__init__.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,44 @@ async def manage_configuration(request):
216216
logging.error(f"Error managing configuration: {str(e)}")
217217
return web.json_response({"error": str(e)}, status=500)
218218

219+
@routes.post('/comfystream/settings/manage')
220+
async def manage_comfystream(request):
221+
"""Manage ComfyStream server settings"""
222+
#check if server is running
223+
server_status = server_manager.get_status()
224+
if not server_status["running"]:
225+
return web.json_response({"error": "ComfyStream Server is not running"}, status=503)
226+
227+
try:
228+
data = await request.json()
229+
action_type = data.get("action_type")
230+
action = data.get("action")
231+
payload = data.get("payload")
232+
url_host = server_status.get("host", "localhost")
233+
url_port = server_status.get("port", "8889")
234+
mgmt_url = f"http://{url_host}:{url_port}/settings/{action_type}/{action}"
235+
236+
async with aiohttp.ClientSession() as session:
237+
async with session.post(
238+
mgmt_url,
239+
json=payload,
240+
headers={"Content-Type": "application/json"}
241+
) as response:
242+
if not response.ok:
243+
return web.json_response(
244+
{"error": f"Server error: {response.status}"},
245+
status=response.status
246+
)
247+
return web.json_response(await response.json())
248+
except Exception as e:
249+
logging.error(f"Error managing ComfyStream: {str(e)}")
250+
return web.json_response({"error": str(e)}, status=500)
251+
219252
@routes.post('/comfyui/restart')
220253
async def manage_configuration(request):
254+
server_status = server_manager.get_status()
255+
if server_status["running"]:
256+
await server_manager.stop()
257+
221258
subprocess.run(["supervisorctl", "restart", "comfyui"])
222259
return web.json_response({"success": True}, status=200)

nodes/web/js/launcher.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ const extension = {
341341
comfyStreamMenu.addSeparator();
342342
comfyStreamMenu.addItem("Server Settings", openSettings, { icon: "pi pi-cog" });
343343
comfyStreamMenu.addSeparator();
344-
comfyStreamMenu.addItem("Restart Server", () => restartComfyUI(), { icon: "pi pi-refresh" });
344+
comfyStreamMenu.addItem("Restart ComfyUI", () => restartComfyUI(), { icon: "pi pi-refresh" });
345345
}
346346
// New menu system is handled automatically by the menuCommands registration
347347

0 commit comments

Comments
 (0)