fix: better error handling
Some checks failed
black-action / runner / black formatter (push) Failing after -1m6s

This commit is contained in:
0xMRTT 2023-06-09 20:06:20 +02:00
parent 91b177500c
commit e202625c70
Signed by: 0xMRTT
GPG Key ID: 910B287304120902

View File

@ -727,11 +727,9 @@ def run():
else:
return
prompt = " ".join(arg for arg in match.args())
response = "".join(Completion.create(prompt))
try:
prompt = " ".join(arg for arg in match.args())
response = "".join(Completion.create(prompt))
await bot.api.send_markdown_message(
room.room_id, f"> {prompt}\n\n{response}"
)
@ -754,8 +752,8 @@ def run():
else:
return
try:
print(match.args())
prompt = ""
negative = ""
@ -804,7 +802,6 @@ def run():
return filename
try:
filename = await generate_image(prompt, style, ratio, negative)
await bot.api.send_image_message(
@ -823,6 +820,7 @@ def run():
@bot.listener.on_message_event
async def bot_help(room, message):
styles = ", ".join([style.name for style in Style])
ratios = ", ".join([ratio.name for ratio in Ratio])
bot_help_message = f"""
Help Message:
prefix: {PREFIX}
@ -831,15 +829,15 @@ Help Message:
command: help, ?, h
description: display help command
ask:
command: ask, ai
command: {", ".join(AI_COMMAND_ALIASES)}
description: ask gpt a question
img:
command: img, i
command: {", ".join(IMAGE_COMMAND_ALIASES)}
description: generate an image from a prompt
options:
neg:
description: negative prompt
example: neg=low quality
example: neg=low
style:
description: style of image
example: style=IMAGINE_V3
@ -847,7 +845,7 @@ Help Message:
ratio:
description: ratio of image
example: ratio=RATIO_1X1
values: RATIO_1X1, RATIO_9X16, RATIO_16X9, RATIO_4X3, RATIO_3X2
values: {ratios}
"""
match = botlib.MessageMatch(room, message, bot, PREFIX)