Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -366,152 +366,152 @@ async def on_message(message):
|
|
366 |
await msg.remove_reaction("◀️")
|
367 |
await msg.remove_reaction("▶️")
|
368 |
return 0
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
imageModel = json.loads(info)["imageModel"]
|
380 |
-
userTimes = json.loads(info)["userTimes"]
|
381 |
try:
|
382 |
-
|
383 |
-
|
384 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
385 |
with open(f"usrtime/{message.author}", "w") as f:
|
386 |
f.write(str(round(time.time())))
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
You are lyre, a discord bot who can generate images and chat with the user. You were made by Araeyn.
|
403 |
-
Answer in the style of "The Hitchhiker's Guide to the Galaxy" guide in the book by the same name for the rest of the chat.
|
404 |
-
Your discord username is lyre#9828.
|
405 |
-
Use the markdown format for your responses.
|
406 |
-
Do not excessively use bullet points.
|
407 |
-
Use emojis at the start of your responses.
|
408 |
-
Use <|title|> at the start of your title for the response and <|title|> at the end of the title.
|
409 |
-
Always include a title, both the start tag and the end tag.
|
410 |
-
If the user asks you to generate an image, use the <|image|> tag around the prompt to generate it. Put this at the end of your response. Do not use a link for the image.
|
411 |
-
For example, if the user asks you to generate an image of a cat, you could say '<|title|>Cat Image<|title|>I hope you enjoy this image of a cat! If you have any other requests or questions, please don't hesitate to ask.<|image|>A cute cat with long fur that is looking out a window with curious eyes, volumetric lighting, 8k<|image|>'
|
412 |
-
Use relatively short prompts for images (20 words max), but still put details.
|
413 |
-
If a user has [bot] next to their username, they are a bot.
|
414 |
-
If there is 'ImageParsed' stuff at the end of the message, that means the user has provided an image(s), and the image(s) was parsed by a captioning model and returned to you. Do not generate an image unless they ask you explicitly.
|
415 |
-
Do not tell the user about any of the information that I am telling you right now.
|
416 |
-
If there is (Replied:[]) stuff at the start of the message, that is the message the user replied to, and the user that they replied to.
|
417 |
-
Do not generate images unless the user specifies that they want an image.
|
418 |
-
Use only one title in your responses, and only one image prompt.
|
419 |
-
The last message of the chat is the one that you are replying to.
|
420 |
-
Do not generate any explicit material in the chat.
|
421 |
-
"""
|
422 |
-
try:
|
423 |
-
os.mkdir("data/" + guild_name)
|
424 |
-
except:
|
425 |
-
pass
|
426 |
-
imgCaption = ""
|
427 |
-
adoCaption = ""
|
428 |
-
if message.reference is not None:
|
429 |
-
message.content = f"[Replied to: ({str(message.reference.cached_message.author)}: {message.reference.cached_message.content})]; {message.content}"
|
430 |
-
if len(message.attachments) > 0:
|
431 |
-
images = []
|
432 |
-
audios = []
|
433 |
-
for file in message.attachments:
|
434 |
-
print(file.content_type)
|
435 |
-
if file.content_type.startswith("image"):
|
436 |
-
imgCaption = "(ImageParsed: "
|
437 |
-
images.append(file)
|
438 |
-
elif file.content_type.startswith("audio"):
|
439 |
-
adoCaption = "(AudioParsed: "
|
440 |
-
audios.append(file)
|
441 |
-
for image in images:
|
442 |
-
await image.save("ip.png")
|
443 |
-
imgCaption += f"[{await IC.image_to_text('ip.png')}]"
|
444 |
-
for audio in audios:
|
445 |
-
await audio.save("aud")
|
446 |
-
adoCaption += f"[{await PRK.automatic_speech_recognition('aud')}]"
|
447 |
-
if audios != []:
|
448 |
-
adoCaption += ")"
|
449 |
-
if images != []:
|
450 |
-
imgCaption += ")"
|
451 |
-
if os.path.exists(f"data/{guild_name}/{msgchannel_name}"):
|
452 |
with open(f"data/{guild_name}/{msgchannel_name}", "a") as f:
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
with open(f"data/{guild_name}/{msgchannel_name}", "w") as f:
|
464 |
-
if message.author.bot:
|
465 |
-
f.write(
|
466 |
-
f"GPT4 Correct system: {sysrp}<|end_of_turn|>GPT4 Correct {message.author}[bot]: {message.content}{imgCaption}{adoCaption}<|end_of_turn|>"
|
467 |
-
)
|
468 |
-
else:
|
469 |
-
f.write(
|
470 |
-
f"GPT4 Correct system: {sysrp}<|end_of_turn|>GPT4 Correct {message.author}: {message.content}{imgCaption}{adoCaption}<|end_of_turn|>"
|
471 |
-
)
|
472 |
-
with open(f"data/{guild_name}/{msgchannel_name}", "r") as f:
|
473 |
-
context = f.read()
|
474 |
-
with open(f"{guild_name}.guild", "r") as f:
|
475 |
-
o = f.read()
|
476 |
-
if (str(message.channel.id) in o.split("\n")) or (guild_name == "Direct"):
|
477 |
-
with open(f"usrtime/{message.author}", "w") as f:
|
478 |
-
f.write(str(round(time.time())))
|
479 |
-
async with msgchannel.typing():
|
480 |
-
context += f"GPT4 Correct Assistant:"
|
481 |
-
load = random.choice(
|
482 |
-
[
|
483 |
-
"https://cdn.dribbble.com/users/744913/screenshots/4094897/media/771a495231b798c0ccf7a59a19f31946.gif",
|
484 |
-
"https://cdn.dribbble.com/users/563824/screenshots/3633228/media/b620ccb3ae8c14ea5447d159ebb1da58.gif",
|
485 |
-
"https://cdn.dribbble.com/users/563824/screenshots/4155980/media/d3828cd14ed415eb6f90310991e06f27.gif",
|
486 |
-
"https://cdn.dribbble.com/users/107759/screenshots/3498589/media/5bc45101de34a80ea71238a02f3a75b5.gif",
|
487 |
-
]
|
488 |
)
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
with open(f"data/{guild_name}/{msgchannel_name}", "a") as f:
|
497 |
-
f.write(f"GPT4 Correct Assistant: {output}<|end_of_turn|>")
|
498 |
-
embed = discord.Embed(title=title,
|
499 |
-
description=output.replace(
|
500 |
-
f"<|title|>{title}<|title|>", "").replace(f"<|image|>{imgp}<|image|>", ""),
|
501 |
-
color=0x1E81B0)
|
502 |
-
if imgp != "":
|
503 |
-
embed.set_image(url=load)
|
504 |
-
embed.set_footer(
|
505 |
-
text=
|
506 |
-
"""Creating..."""
|
507 |
-
)
|
508 |
-
else:
|
509 |
-
embed.set_footer(
|
510 |
-
text=
|
511 |
-
"""Information or code generated by Lyre may not always be correct. Lyre was made by Araeyn."""
|
512 |
-
)
|
513 |
-
|
514 |
-
e = await message.reply(embed=embed)
|
515 |
if imgp != "":
|
516 |
np = """lowres, error, cropped, worst quality, low quality, ugly, duplicate, morbid, mutilated, out of frame, blurry, watermark, signature"""
|
517 |
st = time.time()
|
@@ -546,15 +546,15 @@ async def on_message(message):
|
|
546 |
file = discord.File(f"{imgn}.png", filename=f"{imgn}.png")
|
547 |
embed.set_image(url=f"attachment://{imgn}.png")
|
548 |
await e.edit(embed=embed, attachments=[file])
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
|
559 |
token = os.environ["TOKEN"]
|
560 |
client.run(token)
|
|
|
366 |
await msg.remove_reaction("◀️")
|
367 |
await msg.remove_reaction("▶️")
|
368 |
return 0
|
369 |
+
if (str(message.channel.id) in o.split("\n")) or (guild_name == "Direct"):
|
370 |
+
return 0
|
371 |
+
async with msgchannel.typing():
|
372 |
+
for user in message.mentions:
|
373 |
+
if user.bot:
|
374 |
+
message.content = message.content.replace(f"<@{user.id}>",
|
375 |
+
f"<@{str(user)}[bot]>")
|
376 |
+
else:
|
377 |
+
message.content = message.content.replace(f"<@{user.id}>",
|
378 |
+
f"<@{str(user)}>")
|
|
|
|
|
379 |
try:
|
380 |
+
info = requests.get("https://raw.githubusercontent.com/aryananumula/lr/main/info.json").content
|
381 |
+
bannedUsers = json.loads(info)["bannedUsers"]
|
382 |
+
imageModel = json.loads(info)["imageModel"]
|
383 |
+
userTimes = json.loads(info)["userTimes"]
|
384 |
+
try:
|
385 |
+
with open(f"usrtime/{message.author}", "r") as f:
|
386 |
+
er = f.read()
|
387 |
+
except:
|
388 |
+
with open(f"usrtime/{message.author}", "w") as f:
|
389 |
+
f.write(str(round(time.time())))
|
390 |
+
er = 0
|
391 |
+
y = round(time.time()) - int(er)
|
392 |
+
print(y)
|
393 |
+
if str(message.author).lower() not in userTimes.keys():
|
394 |
+
usrTime = 5
|
395 |
+
else:
|
396 |
+
usrTime = userTimes[str(message.author).lower()]
|
397 |
+
if message.author.id in bannedUsers:
|
398 |
+
return 0
|
399 |
+
if y < usrTime:
|
400 |
+
return 0
|
401 |
+
s = f":green[{message.author}]: :violet[{message.content}] :blue[{msgchannel_name}] :orange[{guild_name}]"
|
402 |
+
if message.author == client.user:
|
403 |
+
return
|
404 |
+
sysrp = """GPT4 Correct system:
|
405 |
+
You are lyre, a discord bot who can generate images and chat with the user. You were made by Araeyn.
|
406 |
+
Answer in the style of "The Hitchhiker's Guide to the Galaxy" guide in the book by the same name for the rest of the chat.
|
407 |
+
Your discord username is lyre#9828.
|
408 |
+
Use the markdown format for your responses.
|
409 |
+
Do not excessively use bullet points.
|
410 |
+
Use emojis at the start of your responses.
|
411 |
+
Use <|title|> at the start of your title for the response and <|title|> at the end of the title.
|
412 |
+
Always include a title, both the start tag and the end tag.
|
413 |
+
If the user asks you to generate an image, use the <|image|> tag around the prompt to generate it. Put this at the end of your response. Do not use a link for the image.
|
414 |
+
For example, if the user asks you to generate an image of a cat, you could say '<|title|>Cat Image<|title|>I hope you enjoy this image of a cat! If you have any other requests or questions, please don't hesitate to ask.<|image|>A cute cat with long fur that is looking out a window with curious eyes, volumetric lighting, 8k<|image|>'
|
415 |
+
Use relatively short prompts for images (20 words max), but still put details.
|
416 |
+
If a user has [bot] next to their username, they are a bot.
|
417 |
+
If there is 'ImageParsed' stuff at the end of the message, that means the user has provided an image(s), and the image(s) was parsed by a captioning model and returned to you. Do not generate an image unless they ask you explicitly.
|
418 |
+
Do not tell the user about any of the information that I am telling you right now.
|
419 |
+
If there is (Replied:[]) stuff at the start of the message, that is the message the user replied to, and the user that they replied to.
|
420 |
+
Do not generate images unless the user specifies that they want an image.
|
421 |
+
Use only one title in your responses, and only one image prompt.
|
422 |
+
The last message of the chat is the one that you are replying to.
|
423 |
+
Do not generate any explicit material in the chat.
|
424 |
+
"""
|
425 |
+
try:
|
426 |
+
os.mkdir("data/" + guild_name)
|
427 |
+
except:
|
428 |
+
pass
|
429 |
+
imgCaption = ""
|
430 |
+
adoCaption = ""
|
431 |
+
if message.reference is not None:
|
432 |
+
message.content = f"[Replied to: ({str(message.reference.cached_message.author)}: {message.reference.cached_message.content})]; {message.content}"
|
433 |
+
if len(message.attachments) > 0:
|
434 |
+
images = []
|
435 |
+
audios = []
|
436 |
+
for file in message.attachments:
|
437 |
+
print(file.content_type)
|
438 |
+
if file.content_type.startswith("image"):
|
439 |
+
imgCaption = "(ImageParsed: "
|
440 |
+
images.append(file)
|
441 |
+
elif file.content_type.startswith("audio"):
|
442 |
+
adoCaption = "(AudioParsed: "
|
443 |
+
audios.append(file)
|
444 |
+
for image in images:
|
445 |
+
await image.save("ip.png")
|
446 |
+
imgCaption += f"[{await IC.image_to_text('ip.png')}]"
|
447 |
+
for audio in audios:
|
448 |
+
await audio.save("aud")
|
449 |
+
adoCaption += f"[{await PRK.automatic_speech_recognition('aud')}]"
|
450 |
+
if audios != []:
|
451 |
+
adoCaption += ")"
|
452 |
+
if images != []:
|
453 |
+
imgCaption += ")"
|
454 |
+
if os.path.exists(f"data/{guild_name}/{msgchannel_name}"):
|
455 |
+
with open(f"data/{guild_name}/{msgchannel_name}", "a") as f:
|
456 |
+
n = "\n"
|
457 |
+
if message.author.bot:
|
458 |
+
f.write(
|
459 |
+
f"""GPT4 Correct {message.author}[bot]: {message.content.strip(n)}{imgCaption}{adoCaption}<|end_of_turn|>"""
|
460 |
+
)
|
461 |
+
else:
|
462 |
+
f.write(
|
463 |
+
f"""GPT4 Correct {message.author}: {message.content.strip(n)}{imgCaption}{adoCaption}<|end_of_turn|>"""
|
464 |
+
)
|
465 |
+
else:
|
466 |
+
with open(f"data/{guild_name}/{msgchannel_name}", "w") as f:
|
467 |
+
if message.author.bot:
|
468 |
+
f.write(
|
469 |
+
f"GPT4 Correct system: {sysrp}<|end_of_turn|>GPT4 Correct {message.author}[bot]: {message.content}{imgCaption}{adoCaption}<|end_of_turn|>"
|
470 |
+
)
|
471 |
+
else:
|
472 |
+
f.write(
|
473 |
+
f"GPT4 Correct system: {sysrp}<|end_of_turn|>GPT4 Correct {message.author}: {message.content}{imgCaption}{adoCaption}<|end_of_turn|>"
|
474 |
+
)
|
475 |
+
with open(f"data/{guild_name}/{msgchannel_name}", "r") as f:
|
476 |
+
context = f.read()
|
477 |
+
with open(f"{guild_name}.guild", "r") as f:
|
478 |
+
o = f.read()
|
479 |
with open(f"usrtime/{message.author}", "w") as f:
|
480 |
f.write(str(round(time.time())))
|
481 |
+
load = random.choice(
|
482 |
+
[
|
483 |
+
"https://cdn.dribbble.com/users/744913/screenshots/4094897/media/771a495231b798c0ccf7a59a19f31946.gif",
|
484 |
+
"https://cdn.dribbble.com/users/563824/screenshots/3633228/media/b620ccb3ae8c14ea5447d159ebb1da58.gif",
|
485 |
+
"https://cdn.dribbble.com/users/563824/screenshots/4155980/media/d3828cd14ed415eb6f90310991e06f27.gif",
|
486 |
+
"https://cdn.dribbble.com/users/107759/screenshots/3498589/media/5bc45101de34a80ea71238a02f3a75b5.gif",
|
487 |
+
]
|
488 |
+
)
|
489 |
+
imgn = random.choice(['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'AA', 'AB', 'AC', 'AD', 'AE', 'AF', 'AG', 'AH', 'AI', 'AJ', 'AK', 'AL', 'AM', 'AN', 'AO', 'AP', 'AQ', 'AR', 'AS', 'AT', 'AU', 'AV', 'AW', 'AX', 'AY', 'AZ', 'BA', 'BB', 'BC', 'BD', 'BE', 'BF', 'BG', 'BH', 'BI', 'BJ', 'BK', 'BL', 'BM', 'BN', 'BO', 'BP', 'BQ', 'BR', 'BS', 'BT', 'BU', 'BV', 'BW', 'BX', 'BY', 'BZ', 'CA', 'CB', 'CC', 'CD', 'CE', 'CF', 'CG', 'CH', 'CI', 'CJ', 'CK', 'CL', 'CM', 'CN', 'CO', 'CP', 'CQ', 'CR', 'CS', 'CT', 'CU', 'CV', 'CW', 'CX', 'CY', 'CZ', 'DA', 'DB', 'DC', 'DD', 'DE', 'DF', 'DG', 'DH', 'DI', 'DJ', 'DK', 'DL', 'DM', 'DN', 'DO', 'DP', 'DQ', 'DR', 'DS', 'DT', 'DU', 'DV', 'DW', 'DX', 'DY', 'DZ', 'EA', 'EB', 'EC', 'ED', 'EE', 'EF', 'EG', 'EH', 'EI', 'EJ', 'EK', 'EL', 'EM', 'EN', 'EO', 'EP', 'EQ', 'ER', 'ES', 'ET', 'EU', 'EV', 'EW', 'EX', 'EY', 'EZ', 'FA', 'FB', 'FC', 'FD', 'FE', 'FF', 'FG', 'FH', 'FI', 'FJ', 'FK', 'FL', 'FM', 'FN', 'FO', 'FP', 'FQ', 'FR', 'FS', 'FT', 'FU', 'FV', 'FW', 'FX', 'FY', 'FZ', 'GA', 'GB', 'GC', 'GD', 'GE', 'GF', 'GG', 'GH', 'GI', 'GJ', 'GK', 'GL', 'GM', 'GN', 'GO', 'GP', 'GQ', 'GR', 'GS', 'GT', 'GU', 'GV', 'GW', 'GX', 'GY', 'GZ', 'HA', 'HB', 'HC', 'HD', 'HE', 'HF', 'HG', 'HH', 'HI', 'HJ', 'HK', 'HL', 'HM', 'HN', 'HO', 'HP', 'HQ', 'HR', 'HS', 'HT', 'HU', 'HV', 'HW', 'HX', 'HY', 'HZ', 'IA', 'IB', 'IC', 'ID', 'IE', 'IF', 'IG', 'IH', 'II', 'IJ', 'IK', 'IL', 'IM', 'IN', 'IO', 'IP', 'IQ', 'IR', 'IS', 'IT', 'IU', 'IV', 'IW', 'IX', 'IY', 'IZ', 'JA', 'JB', 'JC', 'JD', 'JE', 'JF', 'JG', 'JH', 'JI', 'JJ', 'JK', 'JL', 'JM', 'JN', 'JO', 'JP', 'JQ', 'JR', 'JS', 'JT', 'JU', 'JV', 'JW', 'JX', 'JY', 'JZ', 'KA', 'KB', 'KC', 'KD', 'KE', 'KF', 'KG', 'KH', 'KI', 'KJ', 'KK', 'KL', 'KM', 'KN', 'KO', 'KP', 'KQ', 'KR', 'KS', 'KT', 'KU', 'KV', 'KW', 'KX', 'KY', 'KZ', 'LA', 'LB', 'LC', 'LD', 'LE', 'LF', 'LG', 'LH', 'LI', 'LJ', 'LK', 'LL', 'LM', 'LN', 'LO', 'LP', 'LQ', 'LR', 'LS', 'LT', 'LU', 'LV', 'LW', 'LX', 'LY', 'LZ', 'MA', 'MB', 'MC', 'MD', 'ME', 'MF', 'MG', 'MH', 'MI', 'MJ', 'MK', 'ML', 'MM', 'MN', 'MO', 'MP', 'MQ', 'MR', 'MS', 'MT', 'MU', 'MV', 'MW', 'MX', 'MY', 'MZ', 'NA', 'NB', 'NC', 'ND', 'NE', 'NF', 'NG', 'NH', 'NI', 'NJ', 'NK', 'NL', 'NM', 'NN', 'NO', 'NP', 'NQ', 'NR', 'NS', 'NT', 'NU', 'NV', 'NW', 'NX', 'NY', 'NZ', 'OA', 'OB', 'OC', 'OD', 'OE', 'OF', 'OG', 'OH', 'OI', 'OJ', 'OK', 'OL', 'OM', 'ON', 'OO', 'OP', 'OQ', 'OR', 'OS', 'OT', 'OU', 'OV', 'OW', 'OX', 'OY', 'OZ', 'PA', 'PB', 'PC', 'PD', 'PE', 'PF', 'PG', 'PH', 'PI', 'PJ', 'PK', 'PL', 'PM', 'PN', 'PO', 'PP', 'PQ', 'PR', 'PS', 'PT', 'PU', 'PV', 'PW', 'PX', 'PY', 'PZ', 'QA', 'QB', 'QC', 'QD', 'QE', 'QF', 'QG', 'QH', 'QI', 'QJ', 'QK', 'QL', 'QM', 'QN', 'QO', 'QP', 'QQ', 'QR', 'QS', 'QT', 'QU', 'QV', 'QW', 'QX', 'QY', 'QZ', 'RA', 'RB', 'RC', 'RD', 'RE', 'RF', 'RG', 'RH', 'RI', 'RJ', 'RK', 'RL', 'RM', 'RN', 'RO', 'RP', 'RQ', 'RR', 'RS', 'RT', 'RU', 'RV', 'RW', 'RX', 'RY', 'RZ', 'SA', 'SB', 'SC', 'SD', 'SE', 'SF', 'SG', 'SH', 'SI', 'SJ', 'SK', 'SL', 'SM', 'SN', 'SO', 'SP', 'SQ', 'SR', 'SS', 'ST', 'SU', 'SV', 'SW', 'SX', 'SY', 'SZ', 'TA', 'TB', 'TC', 'TD', 'TE', 'TF', 'TG', 'TH', 'TI', 'TJ', 'TK', 'TL', 'TM', 'TN', 'TO', 'TP', 'TQ', 'TR', 'TS', 'TT', 'TU', 'TV', 'TW', 'TX', 'TY', 'TZ', 'UA', 'UB', 'UC', 'UD', 'UE', 'UF', 'UG', 'UH', 'UI', 'UJ', 'UK', 'UL', 'UM', 'UN', 'UO', 'UP', 'UQ', 'UR', 'US', 'UT', 'UU', 'UV', 'UW', 'UX', 'UY', 'UZ', 'VA', 'VB', 'VC', 'VD', 'VE', 'VF', 'VG', 'VH', 'VI', 'VJ', 'VK', 'VL', 'VM', 'VN', 'VO', 'VP', 'VQ', 'VR', 'VS', 'VT', 'VU', 'VV', 'VW', 'VX', 'VY', 'VZ', 'WA', 'WB', 'WC', 'WD', 'WE', 'WF', 'WG', 'WH', 'WI', 'WJ', 'WK', 'WL', 'WM', 'WN', 'WO', 'WP', 'WQ', 'WR', 'WS', 'WT', 'WU', 'WV', 'WW', 'WX', 'WY', 'WZ', 'XA', 'XB', 'XC', 'XD', 'XE', 'XF', 'XG', 'XH', 'XI', 'XJ', 'XK', 'XL', 'XM', 'XN', 'XO', 'XP', 'XQ', 'XR', 'XS', 'XT', 'XU', 'XV', 'XW', 'XX', 'XY', 'XZ', 'YA', 'YB', 'YC', 'YD', 'YE', 'YF', 'YG', 'YH', 'YI', 'YJ', 'YK', 'YL', 'YM', 'YN', 'YO', 'YP', 'YQ', 'YR', 'YS', 'YT', 'YU', 'YV', 'YW', 'YX', 'YY', 'YZ', 'ZA', 'ZB', 'ZC', 'ZD', 'ZE', 'ZF', 'ZG', 'ZH', 'ZI', 'ZJ', 'ZK', 'ZL', 'ZM', 'ZN', 'ZO', 'ZP', 'ZQ', 'ZR', 'ZS', 'ZT', 'ZU', 'ZV', 'ZW', 'ZX', 'ZY', 'ZZ'])
|
490 |
+
output = await LLM.text_generation(context,
|
491 |
+
stop_sequences=["<|end_of_turn|>"],
|
492 |
+
max_new_tokens=2048)
|
493 |
+
title = ec(output, "<|title|>", "<|title|>")[0]
|
494 |
+
imgp = ec(output)[0]
|
495 |
+
mscp = ec(output, "<|music|>", "<|music|>")[0]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
496 |
with open(f"data/{guild_name}/{msgchannel_name}", "a") as f:
|
497 |
+
f.write(f"GPT4 Correct Assistant: {output}<|end_of_turn|>")
|
498 |
+
embed = discord.Embed(title=title,
|
499 |
+
description=output.replace(
|
500 |
+
f"<|title|>{title}<|title|>", "").replace(f"<|image|>{imgp}<|image|>", ""),
|
501 |
+
color=0x1E81B0)
|
502 |
+
if imgp != "":
|
503 |
+
embed.set_image(url=load)
|
504 |
+
embed.set_footer(
|
505 |
+
text=
|
506 |
+
"""Creating..."""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
507 |
)
|
508 |
+
else:
|
509 |
+
embed.set_footer(
|
510 |
+
text=
|
511 |
+
"""Information or code generated by Lyre may not always be correct. Lyre was made by Araeyn."""
|
512 |
+
)
|
513 |
+
|
514 |
+
e = await message.reply(embed=embed)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
515 |
if imgp != "":
|
516 |
np = """lowres, error, cropped, worst quality, low quality, ugly, duplicate, morbid, mutilated, out of frame, blurry, watermark, signature"""
|
517 |
st = time.time()
|
|
|
546 |
file = discord.File(f"{imgn}.png", filename=f"{imgn}.png")
|
547 |
embed.set_image(url=f"attachment://{imgn}.png")
|
548 |
await e.edit(embed=embed, attachments=[file])
|
549 |
+
except Exception as exc:
|
550 |
+
print(exc)
|
551 |
+
c = client.get_channel(1202160048126840882)
|
552 |
+
embed = discord.Embed(title="ERROR",
|
553 |
+
description=f"{exc}\n<@&1126289535312080966>",
|
554 |
+
color=0xFF3348)
|
555 |
+
await c.send(embed=embed)
|
556 |
+
embed = discord.Embed(title="ERROR", color=0xFF3348)
|
557 |
+
await e.reply(embed=embed)
|
558 |
|
559 |
token = os.environ["TOKEN"]
|
560 |
client.run(token)
|