mirror of
https://github.com/karpathy/nanochat.git
synced 2026-05-14 03:38:02 +00:00
fix(chat-api): support Modal inference URL in inference client
The inference client now auto-detects if the URL already ends with /generate (Modal's endpoint URL pattern) and skips appending the path. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
e5b4db1eee
commit
6d3e1f0afd
|
|
@ -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