Skip to content

Commit

Permalink
Update patch list index (#199) (#200)
Browse files Browse the repository at this point in the history
* update list index when patching the server (#199)

* Update patch docs (#199)
  • Loading branch information
PladsElsker authored Jan 9, 2024
1 parent ebed0c4 commit d70d4f6
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib_comfyui/custom_extension_injector.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,13 @@ def patch_prompt_server_add_routes(parsed_class: ast.ClassDef, custom_scripts_pa
...
def add_routes(self):
self.user_manager.add_routes(self.routes)
self.app.add_routes(self.routes)
[...]
self.app.add_routes([
<- add code right there in the list
<- add code right there in the list
web.static('/', self.web_root, follow_symlinks=True),
])
...
Expand All @@ -84,9 +88,11 @@ def add_routes(self):
code_patch = generate_prompt_server_add_routes_code_patch(custom_scripts_path)
extra_line_of_code = ast.parse(code_patch)
try:
add_routes_ast_function.body[2].value.args[0].elts[0:0] = [extra_line_of_code.body[0].value]
add_routes_ast_function.body[3].value.args[0].elts[0:0] = [extra_line_of_code.body[0].value]
except:
raise RuntimeError("Cannot patch comfyui as it is not up to date")
raise RuntimeError("ComfyUI was probably updated with breaking changes. "
"If A1111, ComfyUI and sd-webui-comfyui are up to date, "
"please notify the authors of sd-webui-comfyui.")


def generate_prompt_server_add_routes_code_patch(custom_scripts_path):
Expand Down

0 comments on commit d70d4f6

Please sign in to comment.