mirror of
https://github.com/hibobmaster/matrix_chatgpt_bot.git
synced 2024-10-01 05:35:36 -04:00
Use asyncio.sleep instead of time.sleep
This commit is contained in:
parent
cf976f243e
commit
eceb2bfaaf
@ -4,7 +4,6 @@ api_endpoint from https://github.com/ayaka14732/ChatGPTAPIFree
|
||||
import aiohttp
|
||||
import asyncio
|
||||
import json
|
||||
import time
|
||||
|
||||
api_endpoint_free = "https://chatgpt-api.shn.hk/v1/"
|
||||
headers = {'Content-Type': "application/json"}
|
||||
@ -29,7 +28,7 @@ async def ask(prompt: str) -> str:
|
||||
status_code = response.status
|
||||
if not status_code == 200:
|
||||
# wait 2s
|
||||
time.sleep(2)
|
||||
await asyncio.sleep(2)
|
||||
continue
|
||||
|
||||
resp = await response.read()
|
||||
|
Loading…
Reference in New Issue
Block a user