This commit is contained in:
Saifeddine ALOUI 2024-07-07 19:14:12 +02:00
parent 328b960a0d
commit 2124543494
3 changed files with 18 additions and 3 deletions

View File

@ -594,17 +594,21 @@ class Message:
if new_metadata is not None:
text+=", metadata = ?"
params.append(new_metadata)
self.metadata=new_metadata
if new_ui is not None:
text+=", ui = ?"
params.append(new_ui)
self.ui=new_ui
if started_generating_at is not None:
text+=", started_generating_at = ?"
params.append(started_generating_at)
self.started_generating_at=started_generating_at
if nb_tokens is not None:
text+=", nb_tokens = ?"
params.append(nb_tokens)
self.nb_tokens=nb_tokens
text +=", finished_generating_at = ? WHERE id = ?"

View File

@ -95,4 +95,10 @@ def start_comfyui():
def show_comfyui():
import webbrowser
webbrowser.open(lollmsElfServer.config.comfyui_base_url)
return {"status":True}
return {"status":True}
@router.get("/list_comfyui_models")
def show_comfyui():
from lollms.services.comfyui.lollms_comfyui import LollmsComfyUI
return {"status":True, "models":LollmsComfyUI.get_models_list(lollmsElfServer)}

View File

@ -70,7 +70,7 @@ def install_comfyui(lollms_app:LollmsApplication):
shared_folder = root_dir/"shared"
comfyui_folder = shared_folder / "comfyui"
if comfyui_folder.exists():
if show_yes_no_dialog("warning!","I have detected that there is a previous installation of stable diffusion.\nShould I remove it and continue installing?"):
if show_yes_no_dialog("warning!","I have detected that there is a previous installation of Comfyui.\nShould I remove it and continue installing?"):
shutil.rmtree(comfyui_folder)
elif show_yes_no_dialog("warning!","Continue installation?"):
ASCIIColors.cyan("Installing comfyui conda environment with python 3.10")
@ -234,6 +234,10 @@ class LollmsComfyUI(LollmsTTI):
thread = threading.Thread(target=self.wait_for_service, args=(max_retries, show_warning))
thread.start()
return thread
@staticmethod
def get_models_list(app):
return [str(f.name) for f in (app.lollms_paths.personal_path/"shared"/"comfyui"/"models"/"checkpoints").iterdir()]
def wait_for_service(self, max_retries = 50, show_warning=True):
url = f"{self.comfyui_base_url}"
@ -283,7 +287,8 @@ class LollmsComfyUI(LollmsTTI):
data = json.dumps(p).encode('utf-8')
full_url = "http://{}/prompt".format(url)
req = request.Request(full_url, data=data)
return json.loads(request.urlopen(req).read())
output = request.urlopen(req).read()
return json.loads(output)
def get_image(filename, subfolder):
data = {"filename": filename, "subfolder": subfolder}