fix(workflow_analyzer): ignore generic model_name STRING widgets in metadata/search nodes

Generic widget names such as model_name are no longer treated as local
model references by default. Only folder-backed schemas, known widget
indexes, or a model-typed combo/output pairing now admit an extensionless
value.

This prevents metadata/search nodes (for example Civitai Hash Fetcher)
with a model_name STRING input from being incorrectly reported as missing
models.

Added test_model_name_string_used_as_metadata_query_is_ignored to cover
the regression.
This commit is contained in:
Dariusz L
2026-07-19 19:34:10 +02:00
parent fb600a3868
commit a4460afa65
2 changed files with 48 additions and 1 deletions
+8 -1
View File
@@ -1451,8 +1451,15 @@ def get_node_model_info(
if model_widget_category_hints
else ([effective_category_hint] if effective_category_hint else None)
)
# A generic widget name such as ``model_name`` is useful for choosing a
# category, but it is not proof that an arbitrary STRING value is a local
# model reference. Some metadata/search nodes use that name for human-
# readable titles. Only folder-backed schemas, known widget indexes, or a
# model-typed combo/output pairing are strong enough to admit an
# extensionless value.
category_backed_model_widget = bool(
model_widget_category_hint
model_widget_folder_key_hints
or get_node_model_widget_category_hint(node_type, idx)
or schema_output_category_hint
)
named_model_file_widget = bool(
+40
View File
@@ -209,6 +209,46 @@ class WorkflowAnalyzerCategoryHintTests(unittest.TestCase):
self.assertEqual([], refs)
def test_model_name_string_used_as_metadata_query_is_ignored(self):
workflow = {
"nodes": [
{
"id": 153,
"type": "Civitai Hash Fetcher (Image Saver)",
"inputs": [
{
"name": "username",
"type": "STRING",
"widget": {"name": "username"},
},
{
"name": "model_name",
"type": "STRING",
"widget": {"name": "model_name"},
},
{
"name": "version",
"type": "STRING",
"widget": {"name": "version"},
},
],
"outputs": [{"name": "STRING", "type": "STRING", "links": []}],
"widgets_values": [
"latentheart",
(
"Krea2 [SFW / NSFW] Uncensored - Image-to-Prompt + "
"Prompt Enhancer + 4K Upscaler + CivitAI Metadata"
),
"",
],
}
]
}
refs = analyze_workflow_models(workflow, available_models=[])
self.assertEqual([], refs)
def test_upscale_model_loader_widget_named_model_name_stays_upscale(self):
workflow = {
"nodes": [