CryptoScoutv1 commited on
Commit
1f27920
·
verified ·
1 Parent(s): 5a88623

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -4
app.py CHANGED
@@ -60,17 +60,27 @@ thread_to_client = {}
60
  thread_to_user = {}
61
 
62
  ## /echo command to return the llm repsonse ##
63
- @bot.hybrid_command(name="cryptoportfolio", description="Enter text and parameters like this: /cryptoportfolio 'Hello, how are you?' 'param1' 'param2'")
64
  async def chat(ctx, prompt: str):
65
  if ctx.author.id == bot.user.id:
66
  return
 
 
 
 
 
 
 
 
 
67
  try:
68
- # Acknowledge the command immediately - This is the discord message after the command / is called ##
69
- await ctx.send(f"Processing request: {prompt}")
70
 
 
71
  loop = asyncio.get_running_loop()
72
  client = await loop.run_in_executor(None, get_client, None)
73
- job = client.submit(prompt, api_name="/predict") ## /predict can be used for gradio interface ##
74
  await wait(job)
75
 
76
  try:
@@ -82,6 +92,7 @@ async def chat(ctx, prompt: str):
82
  except Exception as e:
83
  print(f"{e}")
84
 
 
85
  @bot.hybrid_command(name="cshelp", description="Get information on how to use this bot.")
86
  async def help_command(ctx):
87
  help_message = """
 
60
  thread_to_user = {}
61
 
62
  ## /echo command to return the llm repsonse ##
63
+ @bot.hybrid_command(name="cryptoportfolio", description="Enter text and parameters like this: /cryptoportfolio ")
64
  async def chat(ctx, prompt: str):
65
  if ctx.author.id == bot.user.id:
66
  return
67
+ @bot.hybrid_command(name="cryptoportfolio", description="Select a predefined sentence")
68
+ async def crypto_portfolio(ctx,
69
+ selection: Option(str,
70
+ "Select an option",
71
+ choices=[
72
+ "Find the top performing cryptocurrencies of the day.",
73
+ "Find the top performing cryptocurrencies of the week.",
74
+ "Find the top performing cryptocurrencies of the month."
75
+ ])):
76
  try:
77
+ # Acknowledge the command
78
+ await ctx.send(f"Processing request: {selection}")
79
 
80
+ # Simulated external processing
81
  loop = asyncio.get_running_loop()
82
  client = await loop.run_in_executor(None, get_client, None)
83
+ job = client.submit(selection, api_name="/predict")
84
  await wait(job)
85
 
86
  try:
 
92
  except Exception as e:
93
  print(f"{e}")
94
 
95
+
96
  @bot.hybrid_command(name="cshelp", description="Get information on how to use this bot.")
97
  async def help_command(ctx):
98
  help_message = """