Skip to content

Commit

Permalink
Merge pull request #3568 from fishhf/dev
Browse files Browse the repository at this point in the history
fix: use AIOHTTP_CLIENT_TIMEOUT timeout setting for openai streaming response
  • Loading branch information
tjbck authored Jul 1, 2024
2 parents 46a084d f89fa06 commit a036291
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion backend/apps/openai/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 25,7 @@
from config import (
SRC_LOG_LEVELS,
ENABLE_OPENAI_API,
AIOHTTP_CLIENT_TIMEOUT,
OPENAI_API_BASE_URLS,
OPENAI_API_KEYS,
CACHE_DIR,
Expand Down Expand Up @@ -463,7 464,9 @@ async def generate_chat_completion(
streaming = False

try:
session = aiohttp.ClientSession(trust_env=True)
session = aiohttp.ClientSession(
trust_env=True, timeout=aiohttp.ClientTimeout(total=AIOHTTP_CLIENT_TIMEOUT)
)
r = await session.request(
method="POST",
url=f"{url}/chat/completions",
Expand Down

0 comments on commit a036291

Please sign in to comment.