fix: 修复节点名和小部件名称处理逻辑,移除不必要的小写转换,确保数据一致性

This commit is contained in:
iHeyTang 2025-08-20 14:07:38 +08:00
parent 829daebc61
commit e14d64d1d4
1 changed files with 6 additions and 6 deletions

View File

@ -52,7 +52,7 @@ def parse_api_spec(workflow_data: dict) -> Dict[str, Dict[str, Any]]:
if title.startswith(API_INPUT_PREFIX): if title.startswith(API_INPUT_PREFIX):
# 提取节点名去掉API_INPUT_PREFIX前缀 # 提取节点名去掉API_INPUT_PREFIX前缀
node_name = title[len(API_INPUT_PREFIX) :].lower() node_name = title[len(API_INPUT_PREFIX) :]
# 如果节点名不在inputs中创建新的节点条目 # 如果节点名不在inputs中创建新的节点条目
if node_name not in spec["inputs"]: if node_name not in spec["inputs"]:
@ -64,7 +64,7 @@ def parse_api_spec(workflow_data: dict) -> Dict[str, Dict[str, Any]]:
if "inputs" in node: if "inputs" in node:
for a_input in node.get("inputs", []): for a_input in node.get("inputs", []):
if a_input.get("link") is None and "widget" in a_input: if a_input.get("link") is None and "widget" in a_input:
widget_name = a_input["widget"]["name"].lower() widget_name = a_input["widget"]["name"]
# 特殊处理隐藏LoadImage节点的upload字段 # 特殊处理隐藏LoadImage节点的upload字段
if node.get("type") == "LoadImage" and widget_name == "upload": if node.get("type") == "LoadImage" and widget_name == "upload":
@ -82,7 +82,7 @@ def parse_api_spec(workflow_data: dict) -> Dict[str, Dict[str, Any]]:
elif title.startswith(API_OUTPUT_PREFIX): elif title.startswith(API_OUTPUT_PREFIX):
# 提取节点名去掉API_OUTPUT_PREFIX前缀 # 提取节点名去掉API_OUTPUT_PREFIX前缀
node_name = title[len(API_OUTPUT_PREFIX) :].lower() node_name = title[len(API_OUTPUT_PREFIX) :]
# 如果节点名不在outputs中创建新的节点条目 # 如果节点名不在outputs中创建新的节点条目
if node_name not in spec["outputs"]: if node_name not in spec["outputs"]:
@ -93,7 +93,7 @@ def parse_api_spec(workflow_data: dict) -> Dict[str, Dict[str, Any]]:
if "outputs" in node: if "outputs" in node:
for an_output in node.get("outputs", []): for an_output in node.get("outputs", []):
output_name = an_output["name"].lower() output_name = an_output["name"]
# 确保outputs字段存在 # 确保outputs字段存在
if "outputs" not in spec["outputs"][node_name]: if "outputs" not in spec["outputs"][node_name]:
@ -139,7 +139,7 @@ def parse_inputs_json_schema(workflow_data: dict) -> dict:
if title.startswith(API_INPUT_PREFIX): if title.startswith(API_INPUT_PREFIX):
# 提取节点名去掉API_INPUT_PREFIX前缀 # 提取节点名去掉API_INPUT_PREFIX前缀
node_name = title[len(API_INPUT_PREFIX) :].lower() node_name = title[len(API_INPUT_PREFIX) :]
if node_name not in input_nodes: if node_name not in input_nodes:
input_nodes[node_name] = { input_nodes[node_name] = {
@ -152,7 +152,7 @@ def parse_inputs_json_schema(workflow_data: dict) -> dict:
if "inputs" in node: if "inputs" in node:
for a_input in node.get("inputs", []): for a_input in node.get("inputs", []):
if a_input.get("link") is None and "widget" in a_input: if a_input.get("link") is None and "widget" in a_input:
widget_name = a_input["widget"]["name"].lower() widget_name = a_input["widget"]["name"]
# 特殊处理隐藏LoadImage节点的upload字段 # 特殊处理隐藏LoadImage节点的upload字段
if node.get("type") == "LoadImage" and widget_name == "upload": if node.get("type") == "LoadImage" and widget_name == "upload":