fix: chatAI代理配置错误,服务器报错500

This commit is contained in:
feng 2023-12-19 15:39:22 +08:00
parent 1335556272
commit 59d9a3d4ec

View File

@ -47,6 +47,7 @@ class ChatAITestingAPI(GenericAPIView):
'base_url': config['GPT_BASE_URL'] or None,
'api_key': config['GPT_API_KEY'],
}
try:
if proxy:
kwargs['http_client'] = httpx.Client(
proxies=proxy,
@ -56,7 +57,7 @@ class ChatAITestingAPI(GenericAPIView):
ok = False
error = ''
try:
client.chat.completions.create(
messages=[
{