feat: 添加 Rest Api Node 及相关功能节点
新增 Rest Api Node,支持多种 HTTP 方法(GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS)并支持重试设置。同时添加 String Replace Node 和 Retry Settings Node,优化 Key/Value Node 和 Post/Get Node 的功能。更新 README 文档以反映新功能和节点使用说明。
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
class StringReplaceNode:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
"required": {
|
||||
"input_string": ("STRING", {"default": "", "multiline": True}),
|
||||
},
|
||||
"optional": {
|
||||
"placeholders": ("KEY_VALUE", {"default": None}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("STRING",)
|
||||
RETURN_NAMES = ("output_string",)
|
||||
|
||||
FUNCTION = "replace_string"
|
||||
|
||||
CATEGORY = "RequestNode/Utils"
|
||||
|
||||
def replace_string(self, input_string, placeholders=None):
|
||||
if not placeholders:
|
||||
return (input_string,)
|
||||
|
||||
output_string = input_string
|
||||
|
||||
for key, value in placeholders.items():
|
||||
str_value = str(value)
|
||||
output_string = output_string.replace(key, str_value)
|
||||
|
||||
return (output_string,)
|
||||
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
"StringReplaceNode": StringReplaceNode
|
||||
}
|
||||
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"StringReplaceNode": "String Replace Node"
|
||||
}
|
||||
Reference in New Issue
Block a user