fix(acp): preserve colon-bearing custom provider prefixes

Co-authored-by: Taneli Mielikäinen <taneli.mielikainen@iki.fi>
This commit is contained in:
Vadelma
2026-08-09 00:41:49 -07:00
committed by Teknium
parent 7fb6b28ec8
commit 4daaf1e619

View File

@@ -901,11 +901,20 @@ class HermesACPAgent(acp.Agent):
def choice_provider(model_id: str) -> str:
parts = model_id.split(":")
if parts[:1] == ["custom"] and len(parts) > 1:
candidate = f"custom:{parts[1].lower()}"
from hermes_cli.models import _configured_custom_provider_ids
if candidate in _configured_custom_provider_ids():
return candidate
lowered = model_id.lower()
for candidate in sorted(
(
provider_id
for provider_id in _configured_custom_provider_ids()
if provider_id.startswith("custom:")
),
key=len,
reverse=True,
):
if lowered.startswith(candidate + ":"):
return candidate
return "custom"
return parts[0]