Revert force html, since from openai is mixed with markdown

Signed-off-by: Yasir Aris M <git@yasirdev.my.id>
This commit is contained in:
Yasir Aris M 2023-12-14 07:33:09 +07:00 committed by GitHub
parent 593527f5a7
commit 024f825fba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,7 +7,7 @@ import html
import random import random
from openai import AsyncOpenAI, APIConnectionError, RateLimitError, APIStatusError from openai import AsyncOpenAI, APIConnectionError, RateLimitError, APIStatusError
from pyrogram import filters, enums from pyrogram import filters
from pyrogram.errors import MessageTooLong from pyrogram.errors import MessageTooLong
from pyrogram.types import Message from pyrogram.types import Message
@ -73,10 +73,10 @@ async def openai_chatbot(_, ctx: Message, strings):
num += 1 num += 1
answer += chunk.choices[0].delta.content answer += chunk.choices[0].delta.content
if num == 30: if num == 30:
await msg.edit_msg(html.escape(answer), parse_mode=enums.ParseMode.HTML) 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), parse_mode=enums.ParseMode.HTML) await msg.edit_msg(html.escape(answer))
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>")