Add files via upload

This commit is contained in:
Barbariskaa 2023-06-03 00:52:07 +03:00 committed by GitHub
parent 406f24211b
commit 6cf4ebb25a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -392,8 +392,15 @@ class SSEHandler(web.View):
"temperature": 0.7,
"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
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
async for chunk in response.content.iter_chunked(1024):
await self.response.write(chunk)