Compare commits

...
Author SHA1 Message Date
Gerald LonlasandClaude Opus 4.7 a6d471fc9b fix: accept extra kwargs in LMStudioConnect.validate_inputs
ComfyUI can pass any of a node's schema inputs to validate_inputs by
name, depending on the schema version. The current signature only
accepts server_url, timeout_seconds, and max_tokens, so extra inputs
(api_token, model, reasoning_enabled, ...) would raise TypeError before
validation ever runs.

Add **_: Any to absorb any additional inputs ComfyUI provides while
keeping the existing validation logic intact.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-19 00:44:57 +08:00
2 changed files with 30 additions and 1 deletions
+9 -1
View File
@@ -1,5 +1,7 @@
from __future__ import annotations
from typing import Any
from comfy_api.latest import io, ui
from .client import (
@@ -115,7 +117,13 @@ class LMStudioConnect(io.ComfyNode):
)
@classmethod
def validate_inputs(cls, server_url: str, timeout_seconds: int, max_tokens: int) -> bool | str:
def validate_inputs(
cls,
server_url: str,
timeout_seconds: int,
max_tokens: int,
**_: Any,
) -> bool | str:
try:
normalize_server_url(server_url)
except ValueError as exc:
+21
View File
@@ -49,6 +49,27 @@ def test_validate_inputs() -> None:
assert cls.validate_inputs("http://127.0.0.1:1234", 10, 0) == "max_tokens must be >= 1"
def test_validate_inputs_accepts_extra_kwargs() -> None:
connect_node = _connect_module()
cls = connect_node.LMStudioConnect
# ComfyUI may pass any of the schema inputs by name; the method must tolerate them.
assert (
cls.validate_inputs(
"http://127.0.0.1:1234",
10,
128,
api_token="-",
model="placeholder",
reasoning_enabled=False,
use_tooling_mcp=False,
temperature=0.7,
test_connectivity=True,
)
is True
)
def test_execute_with_placeholder_model_uses_discovered_default(
monkeypatch: pytest.MonkeyPatch,
) -> None: