diff --git a/comfyui_llms_wrapper.py b/comfyui_llms_wrapper.py new file mode 100644 index 0000000..9af47d7 --- /dev/null +++ b/comfyui_llms_wrapper.py @@ -0,0 +1,4 @@ +import importlib + +settings = importlib.import_module("custom_nodes.ComfyUI-LLMs.settings") +api_settings = settings.api_settings diff --git a/cyberdolphin_openai_compatible.py b/cyberdolphin_openai_compatible.py index 9dab509..1cb5364 100644 --- a/cyberdolphin_openai_compatible.py +++ b/cyberdolphin_openai_compatible.py @@ -2,6 +2,7 @@ from .openai_client import OpenAiClient from .settings import load_settings + class CyberdolphinOpenAICompatible: @classmethod diff --git a/openai_client.py b/openai_client.py index 0adaaca..6a87217 100644 --- a/openai_client.py +++ b/openai_client.py @@ -3,9 +3,12 @@ from typing import Literal, TypeAlias import PIL.Image from openai import OpenAI -from custom_nodes.ComfyUI-LLMs.settings import api_settings +# from custom_nodes.ComfyUI-LLMs.settings import api_settings +from .comfyui_llms_wrapper import api_settings -DALL_E_SIZE: TypeAlias = Literal["256x256", "512x512", "1024x1024", "1792x1024", "1024x1792"] + +DALL_E_SIZE: TypeAlias = Literal["256x256", + "512x512", "1024x1024", "1792x1024", "1024x1792"] def validation(temperature: float, top_p: float = None) -> list[str]: @@ -68,7 +71,8 @@ class OpenAiClient: errors = validation(temperature, top_p) if errors: error_report = "\n".join([e for e in errors]) - raise RuntimeError(f"There were problems with the parameters:\n{error_report}") + raise RuntimeError( + f"There were problems with the parameters:\n{error_report}") the_client = OpenAiClient.create_client(key) response = the_client.chat.completions.create( model=model,