fix(chat-api): detect Modal URL by domain not path suffix

This commit is contained in:
Manmohan Sharma 2026-04-16 14:59:20 -07:00
parent 2dd914a69d
commit df0584b861
No known key found for this signature in database

View File

@ -84,10 +84,11 @@ class InferenceClient:
}
client = self._get_client()
# If the base_url already ends with a path (e.g. Modal endpoint URL),
# use it directly. Otherwise append /generate for the local service.
# Modal endpoints have the function name in the hostname
# (e.g. ...-generate.modal.run) — POST to root.
# Local inference service needs /generate appended.
url = self.base_url
if not url.endswith("/generate"):
if "modal.run" not in url:
url = f"{url}/generate"
async with client.stream(