fix: sort Nous Portal model list (opus first, sonnet lower)
fetch_nous_models() returned models in whatever order the API gave them, which put sonnet near the top. Add a priority sort so users see the best models first: opus > pro > other > sonnet.
This commit is contained in:
parent
24479625a2
commit
1518734e59
1 changed files with 13 additions and 0 deletions
|
|
@ -1103,6 +1103,19 @@ def fetch_nous_models(
|
||||||
continue
|
continue
|
||||||
model_ids.append(mid)
|
model_ids.append(mid)
|
||||||
|
|
||||||
|
# Sort: prefer opus > pro > haiku/flash > sonnet (sonnet is cheap/fast,
|
||||||
|
# users who want the best model should see opus first).
|
||||||
|
def _model_priority(mid: str) -> tuple:
|
||||||
|
low = mid.lower()
|
||||||
|
if "opus" in low:
|
||||||
|
return (0, mid)
|
||||||
|
if "pro" in low and "sonnet" not in low:
|
||||||
|
return (1, mid)
|
||||||
|
if "sonnet" in low:
|
||||||
|
return (3, mid)
|
||||||
|
return (2, mid)
|
||||||
|
|
||||||
|
model_ids.sort(key=_model_priority)
|
||||||
return list(dict.fromkeys(model_ids))
|
return list(dict.fromkeys(model_ids))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue