edit config_options_node add api protocol
This commit is contained in:
@@ -2,7 +2,7 @@ from comfy_api.latest import ComfyExtension, io
|
||||
|
||||
class ConfigOptions(io.ComfyNode):
|
||||
"""
|
||||
这个节点用于覆盖 API 的配置参数(base_url、api_key、timeout)
|
||||
这个节点用于覆盖 API 的配置参数(api_url、api_key、api_protocol、timeout)
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
@@ -13,9 +13,9 @@ class ConfigOptions(io.ComfyNode):
|
||||
category="YCYY/API/utils",
|
||||
inputs=[
|
||||
io.String.Input(
|
||||
id="base_url",
|
||||
id="api_url",
|
||||
multiline=True,
|
||||
tooltip="Override the API base URL"
|
||||
tooltip="Override the API URL"
|
||||
),
|
||||
io.String.Input(
|
||||
id="api_key",
|
||||
@@ -23,6 +23,12 @@ class ConfigOptions(io.ComfyNode):
|
||||
multiline=True,
|
||||
tooltip="Override the API key"
|
||||
),
|
||||
io.Combo.Input(
|
||||
id="api_protocol",
|
||||
options=["openai-completions", "openai-responses", "anthropic-messages"],
|
||||
default="openai-completions",
|
||||
tooltip="Override the API protocol"
|
||||
),
|
||||
io.Int.Input(
|
||||
id="timeout",
|
||||
default=120,
|
||||
@@ -42,14 +48,15 @@ class ConfigOptions(io.ComfyNode):
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def execute(cls, base_url, api_key, timeout) -> io.NodeOutput:
|
||||
def execute(cls, api_url, api_key, api_protocol, timeout) -> io.NodeOutput:
|
||||
# 验证和清理输入
|
||||
base_url = base_url.strip() if base_url else ""
|
||||
api_url = api_url.strip() if api_url else ""
|
||||
api_key = api_key.strip() if api_key else ""
|
||||
|
||||
config_options = {
|
||||
"base_url": base_url,
|
||||
"api_url": api_url,
|
||||
"api_key": api_key,
|
||||
"api_protocol": api_protocol,
|
||||
"timeout": timeout
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user