Skip to content

Commit

Permalink
Provide interface of methods for frontend
Browse files Browse the repository at this point in the history
Signed-off-by: Florian Esser <florian.esser@tngtech.com>
  • Loading branch information
florianesser-tng committed Dec 4, 2024
1 parent 42482b6 commit 745d460
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
23 changes: 22 additions & 1 deletion service/web_api.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sys

from web_request_bodies import DownloadModelRequestBody
from web_request_bodies import DownloadModelRequestBody, ComfyUICustomNodesDownloadRequest

# Credit to https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/14186
# Related issues:
Expand Down Expand Up @@ -375,6 +375,27 @@ def delete_rag_file():
return jsonify({"code": -1, "message": "failed"})


@app.post("/api/comfy-ui/is_installed")
def is_comfyUI_loaded():
return jsonify({"is_comfyUI_loaded": True})

@app.post("/api/comfy-ui/install")
def is_comfyUI_loaded():

Check failure on line 383 in service/web_api.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F811)

service/web_api.py:383:5: F811 Redefinition of unused `is_comfyUI_loaded` from line 379
return jsonify({"success": True, "error_message": ""})


@app.post("/api/comfy-ui/are_custom_nodes_loaded")
@app.input(ComfyUICustomNodesDownloadRequest.Schema, location='json', arg_name='download_request_data')
def is_comfyUI_loaded(comfyNodeRequest: ComfyUICustomNodesDownloadRequest):

Check failure on line 389 in service/web_api.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F811)

service/web_api.py:389:5: F811 Redefinition of unused `is_comfyUI_loaded` from line 383
return jsonify({ f"{x.username}/{x.reponame}" : True for x in comfyNodeRequest.data })


@app.post("/api/comfy-ui/load_custom_nodes")
@app.input(ComfyUICustomNodesDownloadRequest.Schema, location='json', arg_name='download_request_data')
def is_comfyUI_loaded(comfyNodeRequest: ComfyUICustomNodesDownloadRequest):
return jsonify({ f"{x.username}/{x.reponame}" : {"success": True, "errorMessage": ""} for x in comfyNodeRequest.data })


def cache_input_image():
file = request.files.get("image")
ext = ".png"
Expand Down
8 changes: 8 additions & 0 deletions service/web_request_bodies.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,11 @@ class Meta:
class DownloadModelRequestBody:
data : List[DownloadModelData]

@marshmallow_dataclass.dataclass
class ComfyUICustomNodesGithubRepoId:
username: str
reponame: str

@marshmallow_dataclass.dataclass
class ComfyUICustomNodesDownloadRequest:
data : List[ComfyUICustomNodesGithubRepoId]

0 comments on commit 745d460

Please sign in to comment.