fix(builder): normalize query hyphens for LLM model search matching

Apply same hyphen-to-space normalization to the query that's applied to
model slugs. This ensures 'gpt-4' matches 'gpt 4o' in search.
This commit is contained in:
Bentlybro
2026-02-13 15:11:01 +00:00
parent a7835056c9
commit d6bf54281b

View File

@@ -509,8 +509,10 @@ async def _get_static_counts():
def _matches_llm_model(schema_cls: type[BlockSchema], query: str) -> bool:
for field in schema_cls.model_fields.values():
if field.annotation == LlmModel:
# Normalize query same as model slugs (hyphens to spaces) for matching
normalized_model_query = query.replace("-", " ")
# Check if query matches any value in llm_models from registry
if any(query in name for name in _get_llm_models()):
if any(normalized_model_query in name for name in _get_llm_models()):
return True
return False