CryptoScoutv1 commited on
Commit
15505c9
·
verified ·
1 Parent(s): 5fc81bb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -10
app.py CHANGED
@@ -65,22 +65,16 @@ thread_to_user = {}
65
  ## /echo command to return the llm repsonse ##
66
 
67
  @bot.hybrid_command(name="cstradeadvisor", description="Enter the Cryptocurrency SYMBOL and NAME to generate a market report")
68
- async def chat(ctx, symbol: str, coin_name: str = None): # Add the optional parameter CoinName
69
- if len(symbol) > 5:
70
- await ctx.send("The symbol should be at most 5 characters long.")
71
- return
72
  if ctx.author.id == bot.user.id:
73
  return
74
  try:
75
- # Acknowledge the command immediately
76
- if coin_name:
77
- await ctx.send(f"Generating trade report for - {symbol} {coin_name}. Please wait 2-3 minutes.")
78
- else:
79
- await ctx.send(f"Generating trade report for - {symbol}. Please wait 2-3 minutes.")
80
 
81
  loop = asyncio.get_running_loop()
82
  client = await loop.run_in_executor(None, get_client, None)
83
- job = client.submit(symbol, api_name="/predict")
84
  await wait(job)
85
 
86
  try:
@@ -92,6 +86,7 @@ async def chat(ctx, symbol: str, coin_name: str = None): # Add the optional par
92
  except Exception as e:
93
  print(f"{e}")
94
 
 
95
  @bot.hybrid_command(name="cshelp", description="Get information on how to use this bot.")
96
  async def help_command(ctx):
97
  help_message = """
 
65
  ## /echo command to return the llm repsonse ##
66
 
67
  @bot.hybrid_command(name="cstradeadvisor", description="Enter the Cryptocurrency SYMBOL and NAME to generate a market report")
68
+ async def chat(ctx, prompt: str):
 
 
 
69
  if ctx.author.id == bot.user.id:
70
  return
71
  try:
72
+ # Acknowledge the command immediately - This is the discord message after the command / is called ##
73
+ await ctx.send(f"Processing request: {prompt}")
 
 
 
74
 
75
  loop = asyncio.get_running_loop()
76
  client = await loop.run_in_executor(None, get_client, None)
77
+ job = client.submit(prompt, api_name="/predict") ## /predict can be used for gradio interface ##
78
  await wait(job)
79
 
80
  try:
 
86
  except Exception as e:
87
  print(f"{e}")
88
 
89
+
90
  @bot.hybrid_command(name="cshelp", description="Get information on how to use this bot.")
91
  async def help_command(ctx):
92
  help_message = """