Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -135,7 +135,16 @@ async def on_message(message):
|
|
135 |
s = f":green[{message.author}]: :violet[{message.content}] :blue[{msgchannel_name}] :orange[{guild_name}]"
|
136 |
if message.author == client.user:
|
137 |
return
|
138 |
-
sysp = """You are
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
try:
|
140 |
os.mkdir("data/" + guild_name)
|
141 |
except:
|
@@ -156,22 +165,39 @@ async def on_message(message):
|
|
156 |
context = f.read()
|
157 |
await syncMessages()
|
158 |
if "Feeway" in guild_name:
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
174 |
e = await message.reply(embed=embed)
|
|
|
|
|
|
|
|
|
|
|
|
|
175 |
except Exception as e:
|
176 |
print(Fore.RED)
|
177 |
print(e)
|
|
|
135 |
s = f":green[{message.author}]: :violet[{message.content}] :blue[{msgchannel_name}] :orange[{guild_name}]"
|
136 |
if message.author == client.user:
|
137 |
return
|
138 |
+
sysp = """GPT4 Correct system: You are lr, a discord bot. You were made by Araeyn.
|
139 |
+
You must use the markdown format for your responses.
|
140 |
+
Do not excessively use bullet points.
|
141 |
+
Use emojis at the start of your responses.
|
142 |
+
Use <title> at the start of your title for the response and </title> at the end of the title.
|
143 |
+
Your title must summarize the user's message.
|
144 |
+
If the user asks you to generate an image, use the start tag <image> and the end tag </image> around the prompt to generate it. Put this at the end of your response. Do not use a link for the image.
|
145 |
+
For example, if the user asks you to generate an image of a cat, you would say <image>A cute cat with long fur that is looking out a window with curious eyes.</image>
|
146 |
+
Always include a title.
|
147 |
+
Do not generate images unless the user speciifes that they want an image."""
|
148 |
try:
|
149 |
os.mkdir("data/" + guild_name)
|
150 |
except:
|
|
|
165 |
context = f.read()
|
166 |
await syncMessages()
|
167 |
if "Feeway" in guild_name:
|
168 |
+
async with msgchannel.typing():
|
169 |
+
context += f"GPT4 Correct Assistant:"
|
170 |
+
title = ec(context, "<title>", "</title>")[0]
|
171 |
+
imgp = ec(context)[0]
|
172 |
+
load = random.choice(
|
173 |
+
[
|
174 |
+
"https://cdn.dribbble.com/users/744913/screenshots/4094897/media/771a495231b798c0ccf7a59a19f31946.gif",
|
175 |
+
"https://cdn.dribbble.com/users/563824/screenshots/3633228/media/b620ccb3ae8c14ea5447d159ebb1da58.gif",
|
176 |
+
"https://cdn.dribbble.com/users/563824/screenshots/4155980/media/d3828cd14ed415eb6f90310991e06f27.gif",
|
177 |
+
"https://cdn.dribbble.com/users/107759/screenshots/3498589/media/5bc45101de34a80ea71238a02f3a75b5.gif",
|
178 |
+
]
|
179 |
+
)
|
180 |
+
output = LLM.text_generation(context,
|
181 |
+
stop_sequences=["<|end_of_turn|>"],
|
182 |
+
max_new_tokens=4096)
|
183 |
+
with open(f"data/{guild_name}/{msgchannel_name}", "a") as f:
|
184 |
+
f.write(f"GPT4 Correct Assistant: {output}<|end_of_turn|>")
|
185 |
+
embed = discord.Embed(title=title,
|
186 |
+
description=output.replace(
|
187 |
+
f"<title>{title}</title>", ""),
|
188 |
+
color=0x1E81B0)
|
189 |
+
embed.set_footer(
|
190 |
+
text=
|
191 |
+
"""Information or code generated by Lyre may not always be correct. Lyre was made by Araeyn."""
|
192 |
+
)
|
193 |
+
embed.set_image(load)
|
194 |
e = await message.reply(embed=embed)
|
195 |
+
image = SD.text_to_image(imgp)
|
196 |
+
image.save("image.png")
|
197 |
+
file = discord.File("image.png")
|
198 |
+
embed.set_image("attachment://image.png")
|
199 |
+
e.edit(embed=embed, file=file)
|
200 |
+
|
201 |
except Exception as e:
|
202 |
print(Fore.RED)
|
203 |
print(e)
|