fix: better error handling
Some checks failed
black-action / runner / black formatter (push) Failing after -1m6s
Some checks failed
black-action / runner / black formatter (push) Failing after -1m6s
This commit is contained in:
parent
91b177500c
commit
e202625c70
@ -727,11 +727,9 @@ def run():
|
|||||||
else:
|
else:
|
||||||
return
|
return
|
||||||
|
|
||||||
prompt = " ".join(arg for arg in match.args())
|
|
||||||
|
|
||||||
response = "".join(Completion.create(prompt))
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
prompt = " ".join(arg for arg in match.args())
|
||||||
|
response = "".join(Completion.create(prompt))
|
||||||
await bot.api.send_markdown_message(
|
await bot.api.send_markdown_message(
|
||||||
room.room_id, f"> {prompt}\n\n{response}"
|
room.room_id, f"> {prompt}\n\n{response}"
|
||||||
)
|
)
|
||||||
@ -754,8 +752,8 @@ def run():
|
|||||||
else:
|
else:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
try:
|
||||||
print(match.args())
|
print(match.args())
|
||||||
|
|
||||||
prompt = ""
|
prompt = ""
|
||||||
negative = ""
|
negative = ""
|
||||||
|
|
||||||
@ -804,7 +802,6 @@ def run():
|
|||||||
|
|
||||||
return filename
|
return filename
|
||||||
|
|
||||||
try:
|
|
||||||
filename = await generate_image(prompt, style, ratio, negative)
|
filename = await generate_image(prompt, style, ratio, negative)
|
||||||
|
|
||||||
await bot.api.send_image_message(
|
await bot.api.send_image_message(
|
||||||
@ -823,6 +820,7 @@ def run():
|
|||||||
@bot.listener.on_message_event
|
@bot.listener.on_message_event
|
||||||
async def bot_help(room, message):
|
async def bot_help(room, message):
|
||||||
styles = ", ".join([style.name for style in Style])
|
styles = ", ".join([style.name for style in Style])
|
||||||
|
ratios = ", ".join([ratio.name for ratio in Ratio])
|
||||||
bot_help_message = f"""
|
bot_help_message = f"""
|
||||||
Help Message:
|
Help Message:
|
||||||
prefix: {PREFIX}
|
prefix: {PREFIX}
|
||||||
@ -831,15 +829,15 @@ Help Message:
|
|||||||
command: help, ?, h
|
command: help, ?, h
|
||||||
description: display help command
|
description: display help command
|
||||||
ask:
|
ask:
|
||||||
command: ask, ai
|
command: {", ".join(AI_COMMAND_ALIASES)}
|
||||||
description: ask gpt a question
|
description: ask gpt a question
|
||||||
img:
|
img:
|
||||||
command: img, i
|
command: {", ".join(IMAGE_COMMAND_ALIASES)}
|
||||||
description: generate an image from a prompt
|
description: generate an image from a prompt
|
||||||
options:
|
options:
|
||||||
neg:
|
neg:
|
||||||
description: negative prompt
|
description: negative prompt
|
||||||
example: neg=low quality
|
example: neg=low
|
||||||
style:
|
style:
|
||||||
description: style of image
|
description: style of image
|
||||||
example: style=IMAGINE_V3
|
example: style=IMAGINE_V3
|
||||||
@ -847,7 +845,7 @@ Help Message:
|
|||||||
ratio:
|
ratio:
|
||||||
description: ratio of image
|
description: ratio of image
|
||||||
example: ratio=RATIO_1X1
|
example: ratio=RATIO_1X1
|
||||||
values: RATIO_1X1, RATIO_9X16, RATIO_16X9, RATIO_4X3, RATIO_3X2
|
values: {ratios}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
match = botlib.MessageMatch(room, message, bot, PREFIX)
|
match = botlib.MessageMatch(room, message, bot, PREFIX)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user