Merge pull request #36 from manmohan659/fix/modal-url-detection

fix(chat-api): detect Modal URL by domain not path
This commit is contained in:
Manmohan 2026-04-16 17:59:34 -04:00 committed by GitHub
commit e9885b2583
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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(