mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-13 05:42:26 +08:00
fix: drop isinstance(str) guard so client.base_url fallback works with httpx.URL
The OpenAI SDK exposes client.base_url as an httpx.URL object, not str. The isinstance(live_raw, str) guard made this branch dead code in production. Use _normalized_runtime_url (which coerces via str()) so the fallback actually fires.
This commit is contained in:
@@ -1013,15 +1013,15 @@ def _inherit_parent_base_url(parent_agent, fallback_base_url: Optional[str]) ->
|
||||
|
||||
client = getattr(parent_agent, "client", None)
|
||||
if client is not None:
|
||||
live_raw = getattr(client, "base_url", "")
|
||||
if isinstance(live_raw, str):
|
||||
live_url = _normalized_runtime_url(live_raw)
|
||||
if (
|
||||
live_url
|
||||
and live_url != surface_url
|
||||
and live_url.startswith(("http://", "https://"))
|
||||
):
|
||||
return live_url
|
||||
# OpenAI SDK exposes ``base_url`` as an ``httpx.URL``, not ``str`` —
|
||||
# coerce so the comparison works regardless of the client's type.
|
||||
live_url = _normalized_runtime_url(getattr(client, "base_url", ""))
|
||||
if (
|
||||
live_url
|
||||
and live_url != surface_url
|
||||
and live_url.startswith(("http://", "https://"))
|
||||
):
|
||||
return live_url
|
||||
|
||||
return fallback_base_url or None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user