fix: replace substring alias matching with exact membership check in _base_model_matches
Uses an exact alias membership check instead of substring matching to prevent false positives, e.g. 'zimage' alias no longer incorrectly matches 'zimagebase'.
This commit is contained in:
@@ -501,11 +501,14 @@ def _base_model_matches(candidate: str, preferred: Optional[str]) -> bool:
|
||||
|
||||
from .popular import load_base_model_aliases
|
||||
aliases = load_base_model_aliases()
|
||||
# Exact alias membership check - avoids false positives from substring matching
|
||||
# e.g. prevents "zimage" (Z-Image alias) from matching "zimagebase" (ZImageBase)
|
||||
preferred_tokens = aliases.get(preferred_norm, [preferred_norm])
|
||||
return any(
|
||||
token and (token in candidate_norm or candidate_norm in token)
|
||||
for token in preferred_tokens
|
||||
)
|
||||
if candidate_norm in preferred_tokens:
|
||||
return True
|
||||
# Symmetric check: if preferred is an alias of candidate's model family
|
||||
candidate_tokens = aliases.get(candidate_norm, [candidate_norm])
|
||||
return preferred_norm in candidate_tokens
|
||||
|
||||
|
||||
def _base_model_score(candidate: str, preferred: Optional[str]) -> float:
|
||||
|
||||
@@ -276,11 +276,14 @@ def _base_model_matches(candidate: str, preferred: Optional[str]) -> bool:
|
||||
|
||||
from .popular import load_base_model_aliases
|
||||
aliases = load_base_model_aliases()
|
||||
# Exact alias membership check - avoids false positives from substring matching
|
||||
# e.g. prevents "zimage" (Z-Image alias) from matching "zimagebase" (ZImageBase)
|
||||
preferred_tokens = aliases.get(preferred_norm, [preferred_norm])
|
||||
return any(
|
||||
token and (token in candidate_norm or candidate_norm in token)
|
||||
for token in preferred_tokens
|
||||
)
|
||||
if candidate_norm in preferred_tokens:
|
||||
return True
|
||||
# Symmetric check: if preferred is an alias of candidate's model family
|
||||
candidate_tokens = aliases.get(candidate_norm, [candidate_norm])
|
||||
return preferred_norm in candidate_tokens
|
||||
|
||||
|
||||
def _base_model_score(candidate: str, preferred: Optional[str]) -> float:
|
||||
|
||||
@@ -168,11 +168,14 @@ def _base_model_matches(candidate: str, preferred: Optional[str]) -> bool:
|
||||
|
||||
from .popular import load_base_model_aliases
|
||||
aliases = load_base_model_aliases()
|
||||
# Exact alias membership check - avoids false positives from substring matching
|
||||
# e.g. prevents "zimage" (Z-Image alias) from matching "zimagebase" (ZImageBase)
|
||||
preferred_tokens = aliases.get(preferred_norm, [preferred_norm])
|
||||
return any(
|
||||
token and (token in candidate_norm or candidate_norm in token)
|
||||
for token in preferred_tokens
|
||||
)
|
||||
if candidate_norm in preferred_tokens:
|
||||
return True
|
||||
# Symmetric check: if preferred is an alias of candidate's model family
|
||||
candidate_tokens = aliases.get(candidate_norm, [candidate_norm])
|
||||
return preferred_norm in candidate_tokens
|
||||
|
||||
|
||||
def _base_model_score(candidate: str, preferred: Optional[str]) -> float:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"updated_at": "2026-06-06T17:28:12+00:00",
|
||||
"last_checked_at": "2026-06-06T17:28:12+00:00",
|
||||
"updated_at": "2026-06-06T17:43:51+00:00",
|
||||
"last_checked_at": "2026-06-06T17:43:51+00:00",
|
||||
"local_count": 91,
|
||||
"new_models_added": 79
|
||||
"new_models_added": 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user