From 5d08c2903bbad4a735eb1d1da8aa5fad545e3a8e Mon Sep 17 00:00:00 2001 From: Paillat Date: Thu, 16 Feb 2023 10:52:14 +0100 Subject: [PATCH] Update makeprompt.py --- code/makeprompt.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/code/makeprompt.py b/code/makeprompt.py index 3b51651..813e39b 100644 --- a/code/makeprompt.py +++ b/code/makeprompt.py @@ -142,15 +142,12 @@ To include IMAGES, botator does [image:"here a short title of the image"], then presence_penalty=float(presence_penalty), stop=[" Human:", " AI:", "AI:", "<|endofprompt|>",] ) - except Exception as e: print(e) - await asyncio.sleep(15) - if e == "You exceeded your current quota, please check your plan and billing details.": - await message.channel.send("```diff\n-OPENAI ERROR\nYou exceeded your current quota, please check your plan and billing details.```") - return - else: continue - break + response = None + await message.channel.send(f"```diff\n-Error: OpenAI API ERROR.\n\n{e}```") + return + if response != None: break response = response["choices"][0]["text"] Images_capital = re.findall(r"\[Image:(.*?)\]", response) #replace all [Image:...] with [image:...] so that we can use the same code for both