Skip to content

The agent that grows with you

fix(portal): show FAL for an unset image pick with a Portal model id

kshitijk4poora18c813bd475
diff --git a/hermes_cli/nous_subscription.py b/hermes_cli/nous_subscription.py
index 4f46b1288b7..0724c801b59 100644
--- a/hermes_cli/nous_subscription.py
+++ b/hermes_cli/nous_subscription.py
@@ -292,9 +292,13 @@ def managed_image_partner(config: Dict[str, object]) -> Optional[str]:
from tools.image_generation_managed import FAL, KREA, PORTAL, managed_backend_for_model
section = _section(config, "image_gen")
- if _selected_provider(section, "provider") not in (None, "nous"):
+ selected = _selected_provider(section, "provider")
+ if selected not in (None, "nous"):
return None
- return {FAL: "FAL", KREA: "Krea", PORTAL: "Nous Portal"}[managed_backend_for_model(section.get("model"))]
+ backend = managed_backend_for_model(section.get("model"))
+ if backend == PORTAL and selected != "nous":
+ backend = FAL # an unset pick with a Portal id runs in-tree FAL (see _managed_model_plugin)
+ return {FAL: "FAL", KREA: "Krea", PORTAL: "Nous Portal"}[backend]
def _fal_feature(key: str, tool_enabled: bool, direct: bool, managed: bool, selected: Optional[str]) -> NousFeatureState:
diff --git a/hermes_cli/portal_cli.py b/hermes_cli/portal_cli.py
index e3a05f734e7..3a56f5d7a8f 100644
--- a/hermes_cli/portal_cli.py
+++ b/hermes_cli/portal_cli.py
@@ -118,11 +118,10 @@ def _cmd_tools(args) -> int:
print(color(" Not logged into Nous Portal — sign in with `hermes portal`.", Colors.YELLOW))
print()
- # The managed image row routes by the stored model: FAL, Krea or Nous Portal.
- partners = {"image_gen": managed_image_partner(config)}
label_width = max(len(label) for _, label, _ in _CATALOG)
for key, label, partner in _CATALOG:
- partner = partners.get(key) or partner
+ if key == "image_gen":
+ partner = managed_image_partner(config) or partner
feat = features.features.get(key)
state = color("unknown", Colors.DIM) if feat is None else _feature_state(feat, via_nous="✓ via Nous Portal")
print(f" {label:<{label_width}} partner: {partner:<14} {state}")
diff --git a/tests/hermes_cli/test_nous_subscription.py b/tests/hermes_cli/test_nous_subscription.py
index 88688746ae0..4599ea2b62c 100644
--- a/tests/hermes_cli/test_nous_subscription.py
+++ b/tests/hermes_cli/test_nous_subscription.py
@@ -215,12 +215,13 @@ def test_logged_in_entitled_account_yields_a_state_for_every_feature(monkeypatch
({"provider": "nous", "model": "krea-2-medium"}, "Krea"),
({"model": FAL_DEFAULT_MODEL}, "FAL"),
({"provider": "nous", "model": "openai/gpt-image-2"}, "Nous Portal"),
+ ({"model": "openai/gpt-image-2"}, "FAL"),
({"provider": "openai", "model": "gpt-image-2"}, None),
],
)
def test_managed_image_partner_follows_the_stored_model(image_cfg, partner):
- """One managed image row, three gateways: the stored image_gen.model names the partner; a direct
- vendor selection owns its model id, so no gateway partner is claimed for it."""
+ """The partner is the gateway the runtime actually dispatches to: the stored model decides under
+ the managed pick (Portal ids only with an explicit ``nous``); a direct vendor owns its model id."""
assert ns.managed_image_partner({"image_gen": image_cfg}) == partner