more changes to streamline for our alternate use case
This commit is contained in:
+1
-1
@@ -6,7 +6,7 @@ try:
|
||||
use_generic_nodes = False
|
||||
except:
|
||||
use_generic_nodes = True
|
||||
print("Failed to import comfy.samplers, assuming no comfyui skipping SD related nodes")
|
||||
print("ETK> Failed to import comfy.samplers, assuming no comfyui skipping SD related nodes")
|
||||
|
||||
from custom_nodes.EternalKernelLiteGraphNodes.latent import LatentInterpolation
|
||||
from custom_nodes.EternalKernelLiteGraphNodes.image import PadToMatch
|
||||
|
||||
@@ -5,8 +5,7 @@ try:
|
||||
SaveImage
|
||||
from custom_nodes.ComfyUI_ADV_CLIP_emb.nodes import AdvancedCLIPTextEncode as CLIPTextEncodeAdvanced
|
||||
except ImportError as e:
|
||||
print("comfy.samplers not found, skipping comfyui")
|
||||
print(e)
|
||||
print("ETK> comfy.samplers not found, skipping comfyui")
|
||||
SaveImage = None
|
||||
|
||||
import torch
|
||||
@@ -263,11 +262,15 @@ class ExecWidget:
|
||||
# globals().update(new_locals)
|
||||
# locals().update(new_locals)
|
||||
# print(globals())
|
||||
out_str = new_locals.get("out_str", None)
|
||||
out_string = new_locals.get("out_string", None)
|
||||
out_image = new_locals.get("out_image", None)
|
||||
out_float = new_locals.get("out_float", None)
|
||||
return (out_str, out_image, out_float,)
|
||||
|
||||
return (out_string, out_image, out_float,)
|
||||
@classmethod
|
||||
def IS_CHANGED(s, name):
|
||||
m = hashlib.sha256()
|
||||
m.update(name)
|
||||
return m.digest().hex()
|
||||
|
||||
class PromptTemplate:
|
||||
"""replaces the text in the given text string with a given other text at some key positions"""
|
||||
|
||||
@@ -43,7 +43,6 @@ class SimpleTextWidget:
|
||||
return {"required":
|
||||
{
|
||||
"text": ("STRING", {"multiline": True}),
|
||||
"Display": ("SERVER_STRING", {"multiline": True}),
|
||||
},
|
||||
|
||||
}
|
||||
@@ -52,7 +51,7 @@ class SimpleTextWidget:
|
||||
RETURN_TYPES = ("STRING",)
|
||||
FUNCTION = "handler"
|
||||
|
||||
def handler(self, text,Display):
|
||||
def handler(self, text):
|
||||
ret = self.func(text)
|
||||
return (ret,)
|
||||
|
||||
@@ -79,6 +78,16 @@ avoid numpy and PIL as much as possible
|
||||
class LLMCompletion(SimpleTextWidget):
|
||||
"""uses the input text to call the specified LLM model and returns the output string"""
|
||||
|
||||
def __init__(self):
|
||||
self.func = self.OAI_completion
|
||||
super().__init__(self.func)
|
||||
import uuid
|
||||
self.SSID = str(uuid.uuid4())
|
||||
|
||||
from main import server_obj_holder
|
||||
self.server_string = server_obj_holder[0]["server_strings"]
|
||||
self.server_string[self.SSID] = "empty"
|
||||
|
||||
def OAI_completion(self, text):
|
||||
out_message = [{"role": "user", "content": text}]
|
||||
|
||||
@@ -87,19 +96,8 @@ class LLMCompletion(SimpleTextWidget):
|
||||
messages=out_message
|
||||
)
|
||||
gpt_message = response["choices"][0]["message"]["content"].strip()
|
||||
self.server_strings[self.SSID] = gpt_message
|
||||
self.server_string[self.SSID] = gpt_message
|
||||
return gpt_message
|
||||
|
||||
def __init__(self):
|
||||
self.func = self.OAI_completion
|
||||
super().__init__(self.func)
|
||||
import uuid
|
||||
self.SSID = str(uuid.uuid4())
|
||||
from main import server_obj_holder
|
||||
self.server_strings = server_obj_holder[0].server_strings
|
||||
self.server_strings["self.SSID"] = "empty"
|
||||
|
||||
|
||||
|
||||
|
||||
LLMCompletion.register("LLM_Completion")
|
||||
|
||||
Reference in New Issue
Block a user