Add files via upload
This commit is contained in:
@@ -1,56 +1,56 @@
|
||||
# ComfyUI_StringOps
|
||||
**Efficient Text Processing Tool for ComfyUI Workflow**
|
||||
|
||||
ComfyUI_StringOps is an advanced text processing tool tailored for the ComfyUI workflow, offering robust text manipulation capabilities to address core issues such as text preprocessing, data transformation, and batch automation, enabling efficient and precise operations.
|
||||
|
||||
- **Batch Replacement:**
|
||||
Supports partial or global batch replacement of strings for rapid text processing and delivery to subsequent processes, enhancing task efficiency.
|
||||
|
||||
- **Intelligent Splitting/Concatenation:**
|
||||
Splits text based on character counts and delimiters, and supports flexible recombination of multiple text segments to meet complex processing needs.
|
||||
|
||||
- **Precise Extraction:**
|
||||
Accurately extracts specified content from text using positional indexing and keyword matching, providing precise data support for subsequent processes.
|
||||
|
||||
- **Integration with Excel:**
|
||||
Achieves deep integration with Excel, supporting read and write operations on paged and tabular data, facilitating batch completion of complex tasks and significantly improving efficiency.
|
||||
|
||||
## Update Notes (2025-04-21):
|
||||
1.Added LoadAndAdjustImage node to load and resize images.
|
||||
|
||||
2.Added SaveImagEX node to save images to a specified directory (also added an image output port).
|
||||
|
||||
3.Added functionality to get the current timestamp (can be used as a random seed).
|
||||
|
||||
4.Added the ability to copy and cut files.
|
||||
|
||||
5.Added the feature of reading web page content.
|
||||
|
||||
## Partial Node Display
|
||||
**Text Processing Node**
|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
**Table Data Read/Write Nodes**
|
||||

|
||||
|
||||
ComfyUI_StringOps excels in handling prompts within workflows, especially in organizing and optimizing them, thereby significantly enhancing efficiency and accuracy.
|
||||
|
||||
## Install
|
||||
```cd ComfyUI/custom_nodes```
|
||||
|
||||
```git clone https://github.com/MeeeyoAI/ComfyUI_StringOps.git```
|
||||
|
||||
Or download the zip file and extracted, copy the resulting folder to ```ComfyUI\custom_nodes``` Restart ComfyUI.
|
||||
|
||||
## More Info
|
||||
✅ `bilibili:` https://space.bilibili.com/3546690300676691
|
||||
|
||||
✅ `Website:` http://www.meeeyo.com
|
||||
|
||||
✅ `Sponsorship:` https://t.zsxq.com/ufSS2
|
||||
|
||||
# ComfyUI_StringOps
|
||||
**Efficient Text Processing Tool for ComfyUI Workflow**
|
||||
|
||||
ComfyUI_StringOps is an advanced text processing tool tailored for the ComfyUI workflow, offering robust text manipulation capabilities to address core issues such as text preprocessing, data transformation, and batch automation, enabling efficient and precise operations.
|
||||
|
||||
- **Batch Replacement:**
|
||||
Supports partial or global batch replacement of strings for rapid text processing and delivery to subsequent processes, enhancing task efficiency.
|
||||
|
||||
- **Intelligent Splitting/Concatenation:**
|
||||
Splits text based on character counts and delimiters, and supports flexible recombination of multiple text segments to meet complex processing needs.
|
||||
|
||||
- **Precise Extraction:**
|
||||
Accurately extracts specified content from text using positional indexing and keyword matching, providing precise data support for subsequent processes.
|
||||
|
||||
- **Integration with Excel:**
|
||||
Achieves deep integration with Excel, supporting read and write operations on paged and tabular data, facilitating batch completion of complex tasks and significantly improving efficiency.
|
||||
|
||||
## Update Notes (2025-04-21):
|
||||
1.Added LoadAndAdjustImage node to load and resize images.
|
||||
|
||||
2.Added SaveImagEX node to save images to a specified directory (also added an image output port).
|
||||
|
||||
3.Added functionality to get the current timestamp (can be used as a random seed).
|
||||
|
||||
4.Added the ability to copy and cut files.
|
||||
|
||||
5.Added the feature of reading web page content.
|
||||
|
||||
## Partial Node Display
|
||||
**Text Processing Node**
|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
**Table Data Read/Write Nodes**
|
||||

|
||||
|
||||
ComfyUI_StringOps excels in handling prompts within workflows, especially in organizing and optimizing them, thereby significantly enhancing efficiency and accuracy.
|
||||
|
||||
## Install
|
||||
```cd ComfyUI/custom_nodes```
|
||||
|
||||
```git clone https://github.com/MeeeyoAI/ComfyUI_StringOps.git```
|
||||
|
||||
Or download the zip file and extracted, copy the resulting folder to ```ComfyUI\custom_nodes``` Restart ComfyUI.
|
||||
|
||||
## More Info
|
||||
✅ `bilibili:` https://space.bilibili.com/3546690300676691
|
||||
|
||||
✅ `Website:` http://www.meeeyo.com
|
||||
|
||||
✅ `Sponsorship:` https://t.zsxq.com/ufSS2
|
||||
|
||||
✅ `WeChat`: meeeyo
|
||||
+125
-125
@@ -1,125 +1,125 @@
|
||||
from .meyo_node_Computational import *
|
||||
from .meyo_node_String import *
|
||||
from .meyo_node_File import *
|
||||
from .meyo_node_Functional import *
|
||||
|
||||
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
|
||||
#运算型节点:meyo_node_Computational
|
||||
"CompareInt": CompareInt,
|
||||
"FloatToInteger": FloatToInteger,
|
||||
"GenerateNumbers": GenerateNumbers,
|
||||
"GetRandomIntegerInRange": GetRandomIntegerInRange,
|
||||
|
||||
|
||||
#字符串处理:meyo_node_String
|
||||
"SingleTextInput": SingleTextInput,
|
||||
"MultiParamInputNode": MultiParamInputNode,
|
||||
"AddPrefixSuffix": AddPrefixSuffix,
|
||||
"ExtractSubstring": ExtractSubstring,
|
||||
"ExtractSubstringByIndices": ExtractSubstringByIndices,
|
||||
"SplitStringByDelimiter": SplitStringByDelimiter,
|
||||
"ProcessString": ProcessString,
|
||||
"ExtractBeforeAfter": ExtractBeforeAfter,
|
||||
"ReplaceNthOccurrence": ReplaceNthOccurrence,
|
||||
"ReplaceMultiple": ReplaceMultiple,
|
||||
"BatchReplaceStrings": BatchReplaceStrings,
|
||||
"RandomLineFromText": RandomLineFromText,
|
||||
"CheckSubstringPresence": CheckSubstringPresence,
|
||||
"AddPrefixSuffixToLines": AddPrefixSuffixToLines,
|
||||
"ExtractAndCombineLines": ExtractAndCombineLines,
|
||||
"FilterLinesBySubstrings": FilterLinesBySubstrings,
|
||||
"FilterLinesByWordCount": FilterLinesByWordCount,
|
||||
"SplitAndExtractText": SplitAndExtractText,
|
||||
"CountOccurrences": CountOccurrences,
|
||||
"ExtractLinesByIndex": ExtractLinesByIndex,
|
||||
"ExtractSpecificLines": ExtractSpecificLines,
|
||||
"RemoveContentBetweenChars": RemoveContentBetweenChars,
|
||||
"ShuffleTextLines": ShuffleTextLines,
|
||||
"ConditionalTextOutput": ConditionalTextOutput,
|
||||
"TextConditionCheck": TextConditionCheck,
|
||||
"TextConcatenation": TextConcatenation,
|
||||
"ExtractSpecificData": ExtractSpecificData,
|
||||
"FindFirstLineContent": FindFirstLineContent,
|
||||
|
||||
#文件处理:meyo_node_File
|
||||
"LoadAndAdjustImage": LoadAndAdjustImage,
|
||||
"ImageAdjuster": ImageAdjuster,
|
||||
"CustomCrop": CustomCrop,
|
||||
|
||||
"SaveImagEX": SaveImagEX,
|
||||
"FileCopyCutNode": FileCopyCutNode,
|
||||
"FileDeleteNode": FileDeleteNode,
|
||||
"FileListAndSuffix": FileListAndSuffix,
|
||||
"ReadExcelData": ReadExcelData,
|
||||
"WriteExcelData": WriteExcelData,
|
||||
"FindExcelData": FindExcelData,
|
||||
"ReadExcelRowOrColumnDiff": ReadExcelRowOrColumnDiff,
|
||||
|
||||
#功能型节点:meyo_node_Functional
|
||||
"GetCurrentTime": GetCurrentTime,
|
||||
"SelectionParameter": SelectionParameter,
|
||||
"ReadWebNode": ReadWebNode,
|
||||
}
|
||||
|
||||
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
|
||||
#运算型节点:meyo_node_Computational
|
||||
"CompareInt": "比较数值(meeeyo.com)",
|
||||
"FloatToInteger": "规范数值(meeeyo.com)",
|
||||
"GenerateNumbers": "生成范围数组(meeeyo.com)",
|
||||
"GetRandomIntegerInRange": "范围内随机数(meeeyo.com)",
|
||||
|
||||
#字符串处理:meyo_node_String
|
||||
"SingleTextInput": "文本输入(meeeyo.com)",
|
||||
"MultiParamInputNode": "多参数输入(meeeyo.com)",
|
||||
"AddPrefixSuffix": "添加前后缀(meeeyo.com)",
|
||||
"ExtractSubstring": "提取标签之间(meeeyo.com)",
|
||||
"ExtractSubstringByIndices": "按数字范围提取(meeeyo.com)",
|
||||
"SplitStringByDelimiter": "分隔符拆分两边(meeeyo.com)",
|
||||
"ProcessString": "常规处理字符(meeeyo.com)",
|
||||
"ExtractBeforeAfter": "提取前后字符(meeeyo.com)",
|
||||
"ReplaceNthOccurrence": "替换第n次出现(meeeyo.com)",
|
||||
"ReplaceMultiple": "多次出现依次替换(meeeyo.com)",
|
||||
"BatchReplaceStrings": "批量替换字符(meeeyo.com)",
|
||||
"RandomLineFromText": "随机行内容(meeeyo.com)",
|
||||
"CheckSubstringPresence": "判断是否包含字符(meeeyo.com)",
|
||||
"AddPrefixSuffixToLines": "段落每行添加前后缀(meeeyo.com)",
|
||||
"ExtractAndCombineLines": "段落提取指定索引行(meeeyo.com)",
|
||||
"FilterLinesBySubstrings": "段落提取或移除字符行(meeeyo.com)",
|
||||
"FilterLinesByWordCount": "段落字数条件过滤行(meeeyo.com)",
|
||||
"SplitAndExtractText": "按序号提取分割文本(meeeyo.com)",
|
||||
"CountOccurrences": "文本出现次数(meeeyo.com)",
|
||||
"ExtractLinesByIndex": "文本拆分(meeeyo.com)",
|
||||
"ExtractSpecificLines": "提取特定行(meeeyo.com)",
|
||||
"RemoveContentBetweenChars": "删除标签内的内容(meeeyo.com)",
|
||||
"ShuffleTextLines": "随机打乱(meeeyo.com)",
|
||||
"ConditionalTextOutput": "判断返回内容(meeeyo.com)",
|
||||
"TextConditionCheck": "文本按条件判断(meeeyo.com)",
|
||||
"TextConcatenation": "文本组合(meeeyo.com)",
|
||||
"ExtractSpecificData": "提取多层指定数据(meeeyo.com)",
|
||||
"FindFirstLineContent": "指定字符行参数(meeeyo.com)",
|
||||
|
||||
#文件处理:meyo_node_File
|
||||
"LoadAndAdjustImage": "加载重置图像(meeeyo.com)",
|
||||
"ImageAdjuster": "重置图像(meeeyo.com)",
|
||||
"CustomCrop": "裁剪图像(meeeyo.com)",
|
||||
|
||||
"SaveImagEX": "保存图像(meeeyo.com)",
|
||||
"FileCopyCutNode": "文件操作(meeeyo.com)",
|
||||
"FileDeleteNode": "清理文件(meeeyo.com)",
|
||||
"FileListAndSuffix": "从路径加载(meeeyo.com)",
|
||||
"ReadExcelData": "读取表格数据(meeeyo.com)",
|
||||
"WriteExcelData": "写入表格数据(meeeyo.com)",
|
||||
"FindExcelData": "查找表格数据(meeeyo.com)",
|
||||
"ReadExcelRowOrColumnDiff": "读取表格数量差(meeeyo.com)",
|
||||
|
||||
#功能型节点:meyo_node_Functional
|
||||
"GetCurrentTime": "当前时间(戳)",
|
||||
"SelectionParameter": "选择参数(meeeyo.com)",
|
||||
"ReadWebNode": "读取页面(meeeyo.com)",
|
||||
}
|
||||
|
||||
|
||||
from .meyo_node_Computational import *
|
||||
from .meyo_node_String import *
|
||||
from .meyo_node_File import *
|
||||
from .meyo_node_Functional import *
|
||||
|
||||
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
|
||||
#运算型节点:meyo_node_Computational
|
||||
"CompareInt": CompareInt,
|
||||
"FloatToInteger": FloatToInteger,
|
||||
"GenerateNumbers": GenerateNumbers,
|
||||
"GetRandomIntegerInRange": GetRandomIntegerInRange,
|
||||
|
||||
|
||||
#字符串处理:meyo_node_String
|
||||
"SingleTextInput": SingleTextInput,
|
||||
"MultiParamInputNode": MultiParamInputNode,
|
||||
"AddPrefixSuffix": AddPrefixSuffix,
|
||||
"ExtractSubstring": ExtractSubstring,
|
||||
"ExtractSubstringByIndices": ExtractSubstringByIndices,
|
||||
"SplitStringByDelimiter": SplitStringByDelimiter,
|
||||
"ProcessString": ProcessString,
|
||||
"ExtractBeforeAfter": ExtractBeforeAfter,
|
||||
"ReplaceNthOccurrence": ReplaceNthOccurrence,
|
||||
"ReplaceMultiple": ReplaceMultiple,
|
||||
"BatchReplaceStrings": BatchReplaceStrings,
|
||||
"RandomLineFromText": RandomLineFromText,
|
||||
"CheckSubstringPresence": CheckSubstringPresence,
|
||||
"AddPrefixSuffixToLines": AddPrefixSuffixToLines,
|
||||
"ExtractAndCombineLines": ExtractAndCombineLines,
|
||||
"FilterLinesBySubstrings": FilterLinesBySubstrings,
|
||||
"FilterLinesByWordCount": FilterLinesByWordCount,
|
||||
"SplitAndExtractText": SplitAndExtractText,
|
||||
"CountOccurrences": CountOccurrences,
|
||||
"ExtractLinesByIndex": ExtractLinesByIndex,
|
||||
"ExtractSpecificLines": ExtractSpecificLines,
|
||||
"RemoveContentBetweenChars": RemoveContentBetweenChars,
|
||||
"ShuffleTextLines": ShuffleTextLines,
|
||||
"ConditionalTextOutput": ConditionalTextOutput,
|
||||
"TextConditionCheck": TextConditionCheck,
|
||||
"TextConcatenation": TextConcatenation,
|
||||
"ExtractSpecificData": ExtractSpecificData,
|
||||
"FindFirstLineContent": FindFirstLineContent,
|
||||
|
||||
#文件处理:meyo_node_File
|
||||
"LoadAndAdjustImage": LoadAndAdjustImage,
|
||||
"ImageAdjuster": ImageAdjuster,
|
||||
"CustomCrop": CustomCrop,
|
||||
|
||||
"SaveImagEX": SaveImagEX,
|
||||
"FileCopyCutNode": FileCopyCutNode,
|
||||
"FileDeleteNode": FileDeleteNode,
|
||||
"FileListAndSuffix": FileListAndSuffix,
|
||||
"ReadExcelData": ReadExcelData,
|
||||
"WriteExcelData": WriteExcelData,
|
||||
"FindExcelData": FindExcelData,
|
||||
"ReadExcelRowOrColumnDiff": ReadExcelRowOrColumnDiff,
|
||||
|
||||
#功能型节点:meyo_node_Functional
|
||||
"GetCurrentTime": GetCurrentTime,
|
||||
"SelectionParameter": SelectionParameter,
|
||||
"ReadWebNode": ReadWebNode,
|
||||
}
|
||||
|
||||
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
|
||||
#运算型节点:meyo_node_Computational
|
||||
"CompareInt": "比较数值(meeeyo.com)",
|
||||
"FloatToInteger": "规范数值(meeeyo.com)",
|
||||
"GenerateNumbers": "生成范围数组(meeeyo.com)",
|
||||
"GetRandomIntegerInRange": "范围内随机数(meeeyo.com)",
|
||||
|
||||
#字符串处理:meyo_node_String
|
||||
"SingleTextInput": "文本输入(meeeyo.com)",
|
||||
"MultiParamInputNode": "多参数输入(meeeyo.com)",
|
||||
"AddPrefixSuffix": "添加前后缀(meeeyo.com)",
|
||||
"ExtractSubstring": "提取标签之间(meeeyo.com)",
|
||||
"ExtractSubstringByIndices": "按数字范围提取(meeeyo.com)",
|
||||
"SplitStringByDelimiter": "分隔符拆分两边(meeeyo.com)",
|
||||
"ProcessString": "常规处理字符(meeeyo.com)",
|
||||
"ExtractBeforeAfter": "提取前后字符(meeeyo.com)",
|
||||
"ReplaceNthOccurrence": "替换第n次出现(meeeyo.com)",
|
||||
"ReplaceMultiple": "多次出现依次替换(meeeyo.com)",
|
||||
"BatchReplaceStrings": "批量替换字符(meeeyo.com)",
|
||||
"RandomLineFromText": "随机行内容(meeeyo.com)",
|
||||
"CheckSubstringPresence": "判断是否包含字符(meeeyo.com)",
|
||||
"AddPrefixSuffixToLines": "段落每行添加前后缀(meeeyo.com)",
|
||||
"ExtractAndCombineLines": "段落提取指定索引行(meeeyo.com)",
|
||||
"FilterLinesBySubstrings": "段落提取或移除字符行(meeeyo.com)",
|
||||
"FilterLinesByWordCount": "段落字数条件过滤行(meeeyo.com)",
|
||||
"SplitAndExtractText": "按序号提取分割文本(meeeyo.com)",
|
||||
"CountOccurrences": "文本出现次数(meeeyo.com)",
|
||||
"ExtractLinesByIndex": "文本拆分(meeeyo.com)",
|
||||
"ExtractSpecificLines": "提取特定行(meeeyo.com)",
|
||||
"RemoveContentBetweenChars": "删除标签内的内容(meeeyo.com)",
|
||||
"ShuffleTextLines": "随机打乱(meeeyo.com)",
|
||||
"ConditionalTextOutput": "判断返回内容(meeeyo.com)",
|
||||
"TextConditionCheck": "文本按条件判断(meeeyo.com)",
|
||||
"TextConcatenation": "文本组合(meeeyo.com)",
|
||||
"ExtractSpecificData": "提取多层指定数据(meeeyo.com)",
|
||||
"FindFirstLineContent": "指定字符行参数(meeeyo.com)",
|
||||
|
||||
#文件处理:meyo_node_File
|
||||
"LoadAndAdjustImage": "加载重置图像(meeeyo.com)",
|
||||
"ImageAdjuster": "重置图像(meeeyo.com)",
|
||||
"CustomCrop": "裁剪图像(meeeyo.com)",
|
||||
|
||||
"SaveImagEX": "保存图像(meeeyo.com)",
|
||||
"FileCopyCutNode": "文件操作(meeeyo.com)",
|
||||
"FileDeleteNode": "清理文件(meeeyo.com)",
|
||||
"FileListAndSuffix": "从路径加载(meeeyo.com)",
|
||||
"ReadExcelData": "读取表格数据(meeeyo.com)",
|
||||
"WriteExcelData": "写入表格数据(meeeyo.com)",
|
||||
"FindExcelData": "查找表格数据(meeeyo.com)",
|
||||
"ReadExcelRowOrColumnDiff": "读取表格数量差(meeeyo.com)",
|
||||
|
||||
#功能型节点:meyo_node_Functional
|
||||
"GetCurrentTime": "当前时间(戳)",
|
||||
"SelectionParameter": "选择参数(meeeyo.com)",
|
||||
"ReadWebNode": "读取页面(meeeyo.com)",
|
||||
}
|
||||
|
||||
|
||||
|
||||
+155
-155
@@ -1,155 +1,155 @@
|
||||
import math
|
||||
import random
|
||||
import torch
|
||||
import numpy as np
|
||||
|
||||
#======比较数值
|
||||
class CompareInt:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"input_float": ("FLOAT", {"default": 4.0}),
|
||||
"range": ("STRING", {"default": "3.5-5.5"}),
|
||||
},
|
||||
"optional": {},
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("STRING",)
|
||||
FUNCTION = "compare_float_to_range"
|
||||
CATEGORY = "Meeeyo/Number"
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def compare_float_to_range(self, input_float, range):
|
||||
try:
|
||||
if '-' in range:
|
||||
lower_bound, upper_bound = map(float, range.split('-'))
|
||||
else:
|
||||
lower_bound = upper_bound = float(range)
|
||||
if input_float < lower_bound:
|
||||
return ("小",)
|
||||
elif input_float > upper_bound:
|
||||
return ("大",)
|
||||
else:
|
||||
return ("中",)
|
||||
except ValueError:
|
||||
return ("Error: Invalid input format.",)
|
||||
|
||||
#======规范数值
|
||||
class FloatToInteger:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"float_value": ("FLOAT", {"default": 3.14}),
|
||||
"operation": (["四舍五入", "取大值", "取小值", "最近32倍"], {"default": "四舍五入"}),
|
||||
},
|
||||
"optional": {},
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("INT",)
|
||||
FUNCTION = "convert_float_to_integer"
|
||||
CATEGORY = "Meeeyo/Number"
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def IS_CHANGED():
|
||||
return float("NaN")
|
||||
|
||||
def convert_float_to_integer(self, float_value, operation):
|
||||
if operation == "四舍五入":
|
||||
result = round(float_value)
|
||||
elif operation == "取大值":
|
||||
result = math.ceil(float_value)
|
||||
elif operation == "取小值":
|
||||
result = math.floor(float_value)
|
||||
elif operation == "最近32倍":
|
||||
result = round(float_value / 32) * 32
|
||||
return (result,)
|
||||
|
||||
|
||||
#======生成范围数组
|
||||
class GenerateNumbers:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"range_rule": ("STRING", {"default": "3|1-10"}),
|
||||
"mode": (["顺序", "随机"], {"default": "顺序"}),
|
||||
"prefix_suffix": ("STRING", {"default": "|"}),
|
||||
},
|
||||
"optional": {},
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("STRING",)
|
||||
FUNCTION = "generate_numbers"
|
||||
CATEGORY = "Meeeyo/Number"
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def IS_CHANGED():
|
||||
return float("NaN")
|
||||
|
||||
def generate_numbers(self, range_rule, mode, prefix_suffix):
|
||||
try:
|
||||
start_str, range_str = range_rule.split('|')
|
||||
start = int(start_str)
|
||||
end_range = list(map(int, range_str.split('-')))
|
||||
if len(end_range) == 1:
|
||||
end = end_range[0]
|
||||
numbers = [str(i).zfill(start) for i in range(1, end + 1)]
|
||||
else:
|
||||
start_range, end = end_range
|
||||
numbers = [str(i).zfill(start) for i in range(start_range, end + 1)]
|
||||
if prefix_suffix.strip():
|
||||
prefix, suffix = prefix_suffix.split('|')
|
||||
else:
|
||||
prefix, suffix = "", ""
|
||||
if mode == "随机":
|
||||
random.shuffle(numbers)
|
||||
numbers = [f"{prefix}{num}{suffix}" for num in numbers]
|
||||
result = '\n'.join(numbers)
|
||||
return (result,)
|
||||
except ValueError:
|
||||
return ("",)
|
||||
|
||||
|
||||
#======范围内随机数
|
||||
class GetRandomIntegerInRange:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"range_str": ("STRING", {"default": "0-10"}),
|
||||
},
|
||||
"optional": {},
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("INT", "STRING")
|
||||
FUNCTION = "get_random_integer_in_range"
|
||||
CATEGORY = "Meeeyo/Number"
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def IS_CHANGED():
|
||||
return float("NaN")
|
||||
|
||||
def get_random_integer_in_range(self, range_str):
|
||||
try:
|
||||
start, end = map(int, range_str.split('-'))
|
||||
if start > end:
|
||||
start, end = end, start
|
||||
random_int = random.randint(start, end)
|
||||
return (random_int, str(random_int))
|
||||
except ValueError:
|
||||
return (0, "0")
|
||||
|
||||
import math
|
||||
import random
|
||||
import torch
|
||||
import numpy as np
|
||||
|
||||
#======比较数值
|
||||
class CompareInt:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"input_float": ("FLOAT", {"default": 4.0}),
|
||||
"range": ("STRING", {"default": "3.5-5.5"}),
|
||||
},
|
||||
"optional": {},
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("STRING",)
|
||||
FUNCTION = "compare_float_to_range"
|
||||
CATEGORY = "Meeeyo/Number"
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def compare_float_to_range(self, input_float, range):
|
||||
try:
|
||||
if '-' in range:
|
||||
lower_bound, upper_bound = map(float, range.split('-'))
|
||||
else:
|
||||
lower_bound = upper_bound = float(range)
|
||||
if input_float < lower_bound:
|
||||
return ("小",)
|
||||
elif input_float > upper_bound:
|
||||
return ("大",)
|
||||
else:
|
||||
return ("中",)
|
||||
except ValueError:
|
||||
return ("Error: Invalid input format.",)
|
||||
|
||||
#======规范数值
|
||||
class FloatToInteger:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"float_value": ("FLOAT", {"default": 3.14}),
|
||||
"operation": (["四舍五入", "取大值", "取小值", "最近32倍"], {"default": "四舍五入"}),
|
||||
},
|
||||
"optional": {},
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("INT",)
|
||||
FUNCTION = "convert_float_to_integer"
|
||||
CATEGORY = "Meeeyo/Number"
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def IS_CHANGED():
|
||||
return float("NaN")
|
||||
|
||||
def convert_float_to_integer(self, float_value, operation):
|
||||
if operation == "四舍五入":
|
||||
result = round(float_value)
|
||||
elif operation == "取大值":
|
||||
result = math.ceil(float_value)
|
||||
elif operation == "取小值":
|
||||
result = math.floor(float_value)
|
||||
elif operation == "最近32倍":
|
||||
result = round(float_value / 32) * 32
|
||||
return (result,)
|
||||
|
||||
|
||||
#======生成范围数组
|
||||
class GenerateNumbers:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"range_rule": ("STRING", {"default": "3|1-10"}),
|
||||
"mode": (["顺序", "随机"], {"default": "顺序"}),
|
||||
"prefix_suffix": ("STRING", {"default": "|"}),
|
||||
},
|
||||
"optional": {},
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("STRING",)
|
||||
FUNCTION = "generate_numbers"
|
||||
CATEGORY = "Meeeyo/Number"
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def IS_CHANGED():
|
||||
return float("NaN")
|
||||
|
||||
def generate_numbers(self, range_rule, mode, prefix_suffix):
|
||||
try:
|
||||
start_str, range_str = range_rule.split('|')
|
||||
start = int(start_str)
|
||||
end_range = list(map(int, range_str.split('-')))
|
||||
if len(end_range) == 1:
|
||||
end = end_range[0]
|
||||
numbers = [str(i).zfill(start) for i in range(1, end + 1)]
|
||||
else:
|
||||
start_range, end = end_range
|
||||
numbers = [str(i).zfill(start) for i in range(start_range, end + 1)]
|
||||
if prefix_suffix.strip():
|
||||
prefix, suffix = prefix_suffix.split('|')
|
||||
else:
|
||||
prefix, suffix = "", ""
|
||||
if mode == "随机":
|
||||
random.shuffle(numbers)
|
||||
numbers = [f"{prefix}{num}{suffix}" for num in numbers]
|
||||
result = '\n'.join(numbers)
|
||||
return (result,)
|
||||
except ValueError:
|
||||
return ("",)
|
||||
|
||||
|
||||
#======范围内随机数
|
||||
class GetRandomIntegerInRange:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"range_str": ("STRING", {"default": "0-10"}),
|
||||
},
|
||||
"optional": {},
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("INT", "STRING")
|
||||
FUNCTION = "get_random_integer_in_range"
|
||||
CATEGORY = "Meeeyo/Number"
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def IS_CHANGED():
|
||||
return float("NaN")
|
||||
|
||||
def get_random_integer_in_range(self, range_str):
|
||||
try:
|
||||
start, end = map(int, range_str.split('-'))
|
||||
if start > end:
|
||||
start, end = end, start
|
||||
random_int = random.randint(start, end)
|
||||
return (random_int, str(random_int))
|
||||
except ValueError:
|
||||
return (0, "0")
|
||||
|
||||
|
||||
+828
-828
File diff suppressed because it is too large
Load Diff
+107
-107
@@ -1,108 +1,108 @@
|
||||
import datetime
|
||||
import time
|
||||
import secrets
|
||||
import requests
|
||||
import base64
|
||||
|
||||
|
||||
class GetCurrentTime:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"prefix": ("STRING", {"default": ""}),
|
||||
},
|
||||
"optional": {
|
||||
"any": ("*",),
|
||||
},
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("STRING", "INT")
|
||||
FUNCTION = "get_current_time"
|
||||
CATEGORY = "Meeeyo/Functional"
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def IS_CHANGED():
|
||||
return float("NaN")
|
||||
|
||||
def get_current_time(self, prefix="", any=None):
|
||||
current_time = datetime.datetime.now()
|
||||
formatted_time = current_time.strftime("%Y-%m-%d %H:%M:%S")
|
||||
result = f"{prefix}{formatted_time}"
|
||||
timestamp = int(round(time.time() * 1000))
|
||||
return (result, timestamp)
|
||||
|
||||
|
||||
class SelectionParameter:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"gender": (["男性", "女性"], {"default": "男性"}),
|
||||
"version": (["竖版", "横版"], {"default": "竖版"}),
|
||||
"additional_text": ("STRING", {"multiline": True, "default": "附加的多行文本内容"}),
|
||||
},
|
||||
"optional": {},
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("STRING",)
|
||||
FUNCTION = "gender_output"
|
||||
CATEGORY = "Meeeyo/Functional"
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def gender_output(self, gender, version, additional_text):
|
||||
gender_value = 1 if gender == "男性" else 2
|
||||
version_value = 1 if version == "竖版" else 2
|
||||
result = f"{gender_value}+{version_value}"
|
||||
combined_result = f"{result}\n\n{additional_text.strip()}"
|
||||
return (combined_result,)
|
||||
|
||||
|
||||
class ReadWebNode:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"Instruction": ("STRING", {"default": ""}),
|
||||
"prefix_suffix": ("STRING", {"default": ""}),
|
||||
},
|
||||
"optional": {
|
||||
"any": ("*",),
|
||||
},
|
||||
"hidden": {}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("STRING",)
|
||||
FUNCTION = "fetch_data"
|
||||
CATEGORY = "Meeeyo/Functional"
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def IS_CHANGED():
|
||||
return float("NaN")
|
||||
|
||||
def fetch_data(self, Instruction, prefix_suffix, any=None):
|
||||
if "|" in prefix_suffix:
|
||||
prefix, suffix = prefix_suffix.split("|", 1)
|
||||
else:
|
||||
prefix = prefix_suffix
|
||||
suffix = ""
|
||||
modified_url = f"{base64.b64decode('aHR0cHM6Ly93d3cubWVlZXlvLmNvbS8=').decode()}{Instruction.lower()}{base64.b64decode('LnBocA==').decode()}"
|
||||
|
||||
try:
|
||||
token = secrets.token_hex(16)
|
||||
headers = {'Authorization': f'Bearer {token}'}
|
||||
response = requests.get(modified_url, headers=headers)
|
||||
response.raise_for_status()
|
||||
response_text = f"{prefix}{response.text}{suffix}"
|
||||
return (response_text,)
|
||||
except requests.RequestException as e:
|
||||
import datetime
|
||||
import time
|
||||
import secrets
|
||||
import requests
|
||||
import base64
|
||||
|
||||
|
||||
class GetCurrentTime:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"prefix": ("STRING", {"default": ""}),
|
||||
},
|
||||
"optional": {
|
||||
"any": ("*",),
|
||||
},
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("STRING", "INT")
|
||||
FUNCTION = "get_current_time"
|
||||
CATEGORY = "Meeeyo/Functional"
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def IS_CHANGED():
|
||||
return float("NaN")
|
||||
|
||||
def get_current_time(self, prefix="", any=None):
|
||||
current_time = datetime.datetime.now()
|
||||
formatted_time = current_time.strftime("%Y-%m-%d %H:%M:%S")
|
||||
result = f"{prefix}{formatted_time}"
|
||||
timestamp = int(round(time.time() * 1000))
|
||||
return (result, timestamp)
|
||||
|
||||
|
||||
class SelectionParameter:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"gender": (["男性", "女性"], {"default": "男性"}),
|
||||
"version": (["竖版", "横版"], {"default": "竖版"}),
|
||||
"additional_text": ("STRING", {"multiline": True, "default": "附加的多行文本内容"}),
|
||||
},
|
||||
"optional": {},
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("STRING",)
|
||||
FUNCTION = "gender_output"
|
||||
CATEGORY = "Meeeyo/Functional"
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def gender_output(self, gender, version, additional_text):
|
||||
gender_value = 1 if gender == "男性" else 2
|
||||
version_value = 1 if version == "竖版" else 2
|
||||
result = f"{gender_value}+{version_value}"
|
||||
combined_result = f"{result}\n\n{additional_text.strip()}"
|
||||
return (combined_result,)
|
||||
|
||||
|
||||
class ReadWebNode:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"Instruction": ("STRING", {"default": ""}),
|
||||
"prefix_suffix": ("STRING", {"default": ""}),
|
||||
},
|
||||
"optional": {
|
||||
"any": ("*",),
|
||||
},
|
||||
"hidden": {}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("STRING",)
|
||||
FUNCTION = "fetch_data"
|
||||
CATEGORY = "Meeeyo/Functional"
|
||||
DESCRIPTION = "如需更多帮助或商务需求(For tech and business support)+VX/WeChat: meeeyo"
|
||||
|
||||
def IS_CHANGED():
|
||||
return float("NaN")
|
||||
|
||||
def fetch_data(self, Instruction, prefix_suffix, any=None):
|
||||
if "|" in prefix_suffix:
|
||||
prefix, suffix = prefix_suffix.split("|", 1)
|
||||
else:
|
||||
prefix = prefix_suffix
|
||||
suffix = ""
|
||||
modified_url = f"{base64.b64decode('aHR0cHM6Ly93d3cubWVlZXlvLmNvbS8=').decode()}{Instruction.lower()}{base64.b64decode('LnBocA==').decode()}"
|
||||
|
||||
try:
|
||||
token = secrets.token_hex(16)
|
||||
headers = {'Authorization': f'Bearer {token}'}
|
||||
response = requests.get(modified_url, headers=headers)
|
||||
response.raise_for_status()
|
||||
response_text = f"{prefix}{response.text}{suffix}"
|
||||
return (response_text,)
|
||||
except requests.RequestException as e:
|
||||
return ('Error!解析失败,请检查后重试!',)
|
||||
+1108
-1108
File diff suppressed because it is too large
Load Diff
+6
-6
@@ -1,7 +1,7 @@
|
||||
requests
|
||||
ntplib
|
||||
numpy
|
||||
torch
|
||||
Pillow
|
||||
openpyxl
|
||||
requests
|
||||
ntplib
|
||||
numpy
|
||||
torch
|
||||
Pillow
|
||||
openpyxl
|
||||
chardet
|
||||
Reference in New Issue
Block a user