fix(ollama): bypass stale combo validation for LLM model widgets (#33)
LLMModelSelector and LLMLoadModel validated the model COMBO against _DEFAULT_MODELS, a list fetched once at ComfyUI startup. Models pulled into Ollama afterward showed up in the live-refreshed dropdown but failed prompt validation with "value ... is not available" until the server was restarted. VALIDATE_INPUTS now accepts any model string, deferring to Ollama itself to reject an actually-missing model. Claude-Session: https://claude.ai/code/session_01YArD9ZjBWKsAvazmS48amA Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
56c7d4ca56
commit
a613006f5a
@@ -304,6 +304,18 @@ class LLMModelSelector:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def VALIDATE_INPUTS(cls, model):
|
||||||
|
"""Bypass the frozen-at-startup combo list (see _load_default_models).
|
||||||
|
|
||||||
|
The JS Refresh button keeps the widget's dropdown live, but
|
||||||
|
``_DEFAULT_MODELS`` is only ever populated once, at server start-up.
|
||||||
|
Without this, models pulled into Ollama afterward validate in the
|
||||||
|
UI but fail prompt validation with "value ... is not available"
|
||||||
|
until ComfyUI is restarted.
|
||||||
|
"""
|
||||||
|
return True
|
||||||
|
|
||||||
RETURN_TYPES = ("STRING",)
|
RETURN_TYPES = ("STRING",)
|
||||||
RETURN_NAMES = ("model_name",)
|
RETURN_NAMES = ("model_name",)
|
||||||
FUNCTION = "select_model"
|
FUNCTION = "select_model"
|
||||||
@@ -328,6 +340,11 @@ class LLMLoadModel:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def VALIDATE_INPUTS(cls, model):
|
||||||
|
"""See LLMModelSelector.VALIDATE_INPUTS for why this bypass exists."""
|
||||||
|
return True
|
||||||
|
|
||||||
RETURN_TYPES = ("STRING",)
|
RETURN_TYPES = ("STRING",)
|
||||||
RETURN_NAMES = ("model_name",)
|
RETURN_NAMES = ("model_name",)
|
||||||
FUNCTION = "load_model"
|
FUNCTION = "load_model"
|
||||||
|
|||||||
Reference in New Issue
Block a user