Add files via upload
This commit is contained in:
parent
406f24211b
commit
6cf4ebb25a
9
main.py
9
main.py
|
@ -392,8 +392,15 @@ class SSEHandler(web.View):
|
||||||
"temperature": 0.7,
|
"temperature": 0.7,
|
||||||
"stream": stream
|
"stream": stream
|
||||||
}
|
}
|
||||||
|
if REDIRECT_PROXY.endswith("v1/chat/completions") or REDIRECT_PROXY.endswith("v1/chat/completions/"):
|
||||||
|
url = REDIRECT_PROXY
|
||||||
|
elif REDIRECT_PROXY.endswith("/"):
|
||||||
|
url = f"{REDIRECT_PROXY}v1/chat/completions"
|
||||||
|
else:
|
||||||
|
url = f"{REDIRECT_PROXY}/v1/chat/completions"
|
||||||
|
print(url)
|
||||||
# Use await to wait for the response
|
# Use await to wait for the response
|
||||||
async with session.post(REDIRECT_PROXY, headers=headers, json=body) as response:
|
async with session.post(url, headers=headers, json=body) as response:
|
||||||
# Use async for to iterate over the response chunks
|
# Use async for to iterate over the response chunks
|
||||||
async for chunk in response.content.iter_chunked(1024):
|
async for chunk in response.content.iter_chunked(1024):
|
||||||
await self.response.write(chunk)
|
await self.response.write(chunk)
|
||||||
|
|
Loading…
Reference in New Issue