Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -41,24 +41,12 @@ async def uptime(ctx):
|
|
41 |
|
42 |
await ctx.send(embed=embed)
|
43 |
|
44 |
-
session_count = 0
|
45 |
-
|
46 |
@bot.command()
|
47 |
async def ai(ctx, *, input_text: str):
|
48 |
-
"""Ask our AI model a question. (Session resets every
|
49 |
-
global session_count # Access the global variable
|
50 |
-
|
51 |
-
# Increment session count
|
52 |
-
session_count += 1
|
53 |
|
54 |
try:
|
55 |
-
|
56 |
-
if session_count % 10 == 0:
|
57 |
-
# Start a new session by passing a unique session hash
|
58 |
-
client = grc.Client("https://wop-xxx-opengpt.hf.space/", hf_token=HF_TOKEN)
|
59 |
-
else:
|
60 |
-
# Use the existing session
|
61 |
-
print("skip ses")
|
62 |
|
63 |
# Make a request to the /chat endpoint
|
64 |
result = client.predict(
|
@@ -72,7 +60,7 @@ async def ai(ctx, *, input_text: str):
|
|
72 |
|
73 |
# Create an embed with the AI's response
|
74 |
embed = discord.Embed(title="AI Response", description=result, color=discord.Color.green())
|
75 |
-
embed.add_field(name="Info", value="Session resets every `
|
76 |
embed.set_footer(text="Created by Cosmos")
|
77 |
|
78 |
# Reply with the embed
|
|
|
41 |
|
42 |
await ctx.send(embed=embed)
|
43 |
|
|
|
|
|
44 |
@bot.command()
|
45 |
async def ai(ctx, *, input_text: str):
|
46 |
+
"""Ask our AI model a question. (Session resets every 1 message!)"""\
|
|
|
|
|
|
|
|
|
47 |
|
48 |
try:
|
49 |
+
client = grc.Client("https://wop-xxx-opengpt.hf.space/", hf_token=HF_TOKEN)
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
|
51 |
# Make a request to the /chat endpoint
|
52 |
result = client.predict(
|
|
|
60 |
|
61 |
# Create an embed with the AI's response
|
62 |
embed = discord.Embed(title="AI Response", description=result, color=discord.Color.green())
|
63 |
+
embed.add_field(name="Info", value="Session resets every `1` message!\nModel Name: `Mistral 7B`", inline=False)
|
64 |
embed.set_footer(text="Created by Cosmos")
|
65 |
|
66 |
# Reply with the embed
|