mirror of
https://github.com/karpathy/nanochat.git
synced 2026-05-11 18:30:27 +00:00
Merge pull request #30 from manmohan659/feat/modal-inference
fix(chat-api): support Modal inference URL pattern
This commit is contained in:
commit
5b6eff82e8
|
|
@ -84,9 +84,15 @@ 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.
|
||||
url = self.base_url
|
||||
if not url.endswith("/generate"):
|
||||
url = f"{url}/generate"
|
||||
|
||||
async with client.stream(
|
||||
"POST",
|
||||
f"{self.base_url}/generate",
|
||||
url,
|
||||
headers=self.headers,
|
||||
json=payload,
|
||||
) as response:
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user