Update app.py
Browse files
app.py
CHANGED
@@ -62,16 +62,22 @@ thread_to_user = {}
|
|
62 |
## /echo command to return the llm repsonse ##
|
63 |
|
64 |
@bot.hybrid_command(name="cryptoadvisor", description="Type a crypto symbol or name for a investment plan around 2 minutes for output")
|
65 |
-
async def chat(ctx,
|
|
|
|
|
|
|
66 |
if ctx.author.id == bot.user.id:
|
67 |
return
|
68 |
try:
|
69 |
-
# Acknowledge the command immediately
|
70 |
-
|
|
|
|
|
|
|
71 |
|
72 |
loop = asyncio.get_running_loop()
|
73 |
client = await loop.run_in_executor(None, get_client, None)
|
74 |
-
job = client.submit(
|
75 |
await wait(job)
|
76 |
|
77 |
try:
|
|
|
62 |
## /echo command to return the llm repsonse ##
|
63 |
|
64 |
@bot.hybrid_command(name="cryptoadvisor", description="Type a crypto symbol or name for a investment plan around 2 minutes for output")
|
65 |
+
async def chat(ctx, symbol: str, coin_name: str = None): # Add the optional parameter CoinName
|
66 |
+
if len(symbol) > 5:
|
67 |
+
await ctx.send("The symbol should be at most 5 characters long.")
|
68 |
+
return
|
69 |
if ctx.author.id == bot.user.id:
|
70 |
return
|
71 |
try:
|
72 |
+
# Acknowledge the command immediately
|
73 |
+
if coin_name:
|
74 |
+
await ctx.send(f"Processing: {symbol} with CoinName: {coin_name}")
|
75 |
+
else:
|
76 |
+
await ctx.send(f"Processing: {symbol}")
|
77 |
|
78 |
loop = asyncio.get_running_loop()
|
79 |
client = await loop.run_in_executor(None, get_client, None)
|
80 |
+
job = client.submit(symbol, api_name="/predict")
|
81 |
await wait(job)
|
82 |
|
83 |
try:
|