mirror of
https://github.com/yasirarism/MissKatyPyro.git
synced 2025-12-29 17:44:50 +00:00
Fix stream response
This commit is contained in:
parent
260cd31542
commit
c99815ce04
1 changed files with 2 additions and 2 deletions
|
|
@ -83,7 +83,7 @@ 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.content:
|
if not chunk.choices:
|
||||||
continue
|
continue
|
||||||
num += 1
|
num += 1
|
||||||
answer += chunk.choices[0].delta.content
|
answer += chunk.choices[0].delta.content
|
||||||
|
|
@ -91,7 +91,7 @@ async def openai_chatbot(_, ctx: Message, strings):
|
||||||
await msg.edit_msg(html.escape(answer))
|
await msg.edit_msg(html.escape(answer))
|
||||||
await asyncio.sleep(1.5)
|
await asyncio.sleep(1.5)
|
||||||
num = 0
|
num = 0
|
||||||
await msg.edit_msg(html.escape(answer))
|
await msg.edit_msg(html.escape(f"{answer}\n\nPowered by: <code>GPT 4o</code>"))
|
||||||
except MessageTooLong:
|
except MessageTooLong:
|
||||||
answerlink = await post_to_telegraph(
|
answerlink = await post_to_telegraph(
|
||||||
False, "MissKaty ChatBot ", html.escape(f"<code>{answer}</code>")
|
False, "MissKaty ChatBot ", html.escape(f"<code>{answer}</code>")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue