diff --git a/__init__.py b/__init__.py index d444523d..630a8473 100644 --- a/__init__.py +++ b/__init__.py @@ -537,7 +537,7 @@ async def nodes_map_hander(request): from .nodes.ChatGPT import ChatGPTNode,ShowTextForGPT,CharacterInText from .nodes.Audio import GamePal,SpeechRecognition,SpeechSynthesis -from .nodes.Utils import CreateLoraNames,CreateSampler_names,CreateCkptNames,CreateSeedNode,TESTNODE_,AppInfo,IntNumber,FloatSlider,TextInput,ColorInput,FontInput,TextToNumber,DynamicDelayProcessor,LimitNumber,SwitchByIndex,MultiplicationNode +from .nodes.Utils import CreateLoraNames,CreateSampler_names,CreateCkptNames,CreateSeedNode,TESTNODE_,TESTNODE_TOKEN,AppInfo,IntNumber,FloatSlider,TextInput,ColorInput,FontInput,TextToNumber,DynamicDelayProcessor,LimitNumber,SwitchByIndex,MultiplicationNode from .nodes.Mask import OutlineMask,FeatheredMask @@ -546,6 +546,7 @@ async def nodes_map_hander(request): NODE_CLASS_MAPPINGS = { "AppInfo":AppInfo, "TESTNODE_":TESTNODE_, + "TESTNODE_TOKEN":TESTNODE_TOKEN, "RandomPrompt":RandomPrompt, "EmbeddingPrompt":EmbeddingPrompt, "PromptSlide":PromptSlide, diff --git a/nodes/Utils.py b/nodes/Utils.py index d20ec4d1..348e806b 100644 --- a/nodes/Utils.py +++ b/nodes/Utils.py @@ -381,7 +381,7 @@ class TextInput: @classmethod def INPUT_TYPES(s): return {"required": { - "text": ("STRING",{"multiline": True,"default": ""}), + "text": ("STRING",{"multiline": True,"default": ""}) }, } @@ -695,7 +695,9 @@ def count_types(lst): class TESTNODE_: @classmethod def INPUT_TYPES(s): - return {"required": { "ANY":(any_type,), }, + return {"required": { + "ANY":(any_type,), + }, } RETURN_TYPES = (any_type,) @@ -715,10 +717,42 @@ def run(self,ANY): # 调用count_types方法进行统计 result = list_stats.count_types(ANY) - + + return {"ui": {"data": result,"type":[str(type(ANY[0]))]}, "result": (ANY,)} +class TESTNODE_TOKEN: + @classmethod + def INPUT_TYPES(s): + return {"required": { + "text":("STRING", {"forceInput": True,}), + "clip": ("CLIP", ) + }, + } + + RETURN_TYPES = ("STRING",) + + FUNCTION = "run" + + CATEGORY = "♾️Mixlab/__TEST" + + OUTPUT_NODE = True + INPUT_IS_LIST = False + OUTPUT_IS_LIST = (False,) + + def run(self,text,clip=None): + # print(text) + + tokens = clip.tokenize(text) + + tokens=[v for v in tokens.values()][0][0] + + tokens=json.dumps(tokens) + + return (tokens,) + + class CreateSeedNode: def __init__(self): diff --git a/web/javascript/ui_mixlab.js b/web/javascript/ui_mixlab.js index ca963bde..8456cc7a 100644 --- a/web/javascript/ui_mixlab.js +++ b/web/javascript/ui_mixlab.js @@ -1478,7 +1478,8 @@ app.registerExtension({ widget.element.addEventListener('mouseover', e => { // console.log(node.widgets_values[index]) - widget.element.setAttribute('title', node.widgets_values[index]) + if (node.widgets_values[index]) + widget.element.setAttribute('title', node.widgets_values[index]) }) } }