Skip to content

Commit

Permalink
增加一些seed来控制节点
Browse files Browse the repository at this point in the history
  • Loading branch information
shadowcz007 committed Jan 26, 2024
1 parent a935793 commit 1b55c74
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
6 changes: 4 additions & 2 deletions nodes/PromptNode.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,9 @@ def INPUT_TYPES(s):
"random_sample": (["enable", "disable"],),
# "seed": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff, "step": 1}),
},

"optional":{
"seed": (any_type, {"default": 0, "min": 0, "max": 0xffffffffffffffff}),
}
}


Expand All @@ -339,7 +341,7 @@ def INPUT_TYPES(s):


# 运行的函数
def run(self,max_count,mutable_prompt,immutable_prompt,random_sample):
def run(self,max_count,mutable_prompt,immutable_prompt,random_sample,seed):
# print('#运行的函数',mutable_prompt,immutable_prompt,max_count,random_sample)

# Split the text into an array of words
Expand Down
13 changes: 8 additions & 5 deletions nodes/Utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,14 +200,17 @@ def INPUT_TYPES(s):
return {"required": {
"text": ("STRING",{"multiline": False,"default": "1"}),
"random_number": (["enable", "disable"],),
"number":("INT", {
"default": 0,
"min": 0, #Minimum value
"max_num":("INT", {
"default": 10,
"min":2, #Minimum value
"max": 10000000000, #Maximum value
"step": 1, #Slider's step
"display": "number" # Cosmetic only: display as "number" or "slider"
}),
},
"optional":{
"seed": (any_type, {"default": 0, "min": 0, "max": 0xffffffffffffffff}),
}
}

RETURN_TYPES = ("INT",)
Expand All @@ -220,7 +223,7 @@ def INPUT_TYPES(s):
INPUT_IS_LIST = False
OUTPUT_IS_LIST = (False,)

def run(self,text,random_number,number):
def run(self,text,random_number,max_num,seed):

numbers = re.findall(r'\d+', text)
result=0
Expand All @@ -229,7 +232,7 @@ def run(self,text,random_number,number):
# print(result)

if random_number=='enable' and result>0:
result= random.randint(1, 10000000000)
result= random.randint(1, max_num)
return {"ui": {"text": [text],"num":[result]}, "result": (result,)}


Expand Down

0 comments on commit 1b55c74

Please sign in to comment.