mirror of
https://github.com/yasirarism/MissKatyPyro.git
synced 2026-01-05 03:34:51 +00:00
Sync with latest openai lib
Signed-off-by: Yasir Aris M <git@yasirdev.my.id>
This commit is contained in:
parent
c4421f45f5
commit
4af39b0da6
1 changed files with 2 additions and 2 deletions
|
|
@ -68,10 +68,10 @@ async def openai_chatbot(_, ctx: Message, strings):
|
||||||
stream=True,
|
stream=True,
|
||||||
)
|
)
|
||||||
async for chunk in response:
|
async for chunk in response:
|
||||||
if not chunk.choices[0].delta or chunk.choices[0].delta.get("role"):
|
if not chunk.choices[0].message or chunk.choices[0].message.get("role"):
|
||||||
continue
|
continue
|
||||||
num += 1
|
num += 1
|
||||||
answer += chunk.choices[0].delta.content
|
answer += chunk.choices[0].message.content
|
||||||
if num == 30:
|
if num == 30:
|
||||||
await msg.edit_msg(answer)
|
await msg.edit_msg(answer)
|
||||||
await asyncio.sleep(1.5)
|
await asyncio.sleep(1.5)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue