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: if new_metadata is not None:
text+=", metadata = ?" text+=", metadata = ?"
params.append(new_metadata) params.append(new_metadata)
self.metadata=new_metadata
if new_ui is not None: if new_ui is not None:
text+=", ui = ?" text+=", ui = ?"
params.append(new_ui) params.append(new_ui)
self.ui=new_ui
if started_generating_at is not None: if started_generating_at is not None:
text+=", started_generating_at = ?" text+=", started_generating_at = ?"
params.append(started_generating_at) params.append(started_generating_at)
self.started_generating_at=started_generating_at
if nb_tokens is not None: if nb_tokens is not None:
text+=", nb_tokens = ?" text+=", nb_tokens = ?"
params.append(nb_tokens) params.append(nb_tokens)
self.nb_tokens=nb_tokens
text +=", finished_generating_at = ? WHERE id = ?" text +=", finished_generating_at = ? WHERE id = ?"

View File

@ -96,3 +96,9 @@ def show_comfyui():
import webbrowser import webbrowser
webbrowser.open(lollmsElfServer.config.comfyui_base_url) 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" shared_folder = root_dir/"shared"
comfyui_folder = shared_folder / "comfyui" comfyui_folder = shared_folder / "comfyui"
if comfyui_folder.exists(): 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) shutil.rmtree(comfyui_folder)
elif show_yes_no_dialog("warning!","Continue installation?"): elif show_yes_no_dialog("warning!","Continue installation?"):
ASCIIColors.cyan("Installing comfyui conda environment with python 3.10") ASCIIColors.cyan("Installing comfyui conda environment with python 3.10")
@ -235,6 +235,10 @@ class LollmsComfyUI(LollmsTTI):
thread.start() thread.start()
return thread 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): def wait_for_service(self, max_retries = 50, show_warning=True):
url = f"{self.comfyui_base_url}" url = f"{self.comfyui_base_url}"
# Adjust this value as needed # Adjust this value as needed
@ -283,7 +287,8 @@ class LollmsComfyUI(LollmsTTI):
data = json.dumps(p).encode('utf-8') data = json.dumps(p).encode('utf-8')
full_url = "http://{}/prompt".format(url) full_url = "http://{}/prompt".format(url)
req = request.Request(full_url, data=data) 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): def get_image(filename, subfolder):
data = {"filename": filename, "subfolder": subfolder} data = {"filename": filename, "subfolder": subfolder}