fix(makeprompt.py): fix issue where long response content is not fully sent in chatgpt_process function

The issue was that when the response content was longer than 2000 characters, it was not being fully sent in the chatgpt_process function. This was fixed by adding a loop to send the content in chunks of 2000 characters until the entire content is sent.
This commit is contained in:
Paillat
2023-08-02 10:49:25 +02:00
parent e1f9c91bde
commit 19dd6c9c62

View File

@@ -169,6 +169,14 @@ async def chatgpt_process(
"The function call is empty. Please retry.", delete_after=10 "The function call is empty. Please retry.", delete_after=10
) )
else: else:
content = response.get("content", "")
while len(content) != 0:
if len(content) > 2000:
await message.channel.send(content[:2000])
content = content[2000:]
else:
await message.channel.send(content)
content = ""
await message.channel.send(response["content"]) # type: ignore await message.channel.send(response["content"]) # type: ignore