zakerytclarke commited on
Commit
beef5d8
·
verified ·
1 Parent(s): dbf337d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -12
app.py CHANGED
@@ -144,8 +144,8 @@ client = discord.Client(intents=intents)
144
  async def handle_teapot_inference(server_name, user_input):
145
  teapot_instance = CONFIG.get(server_name, CONFIG["Teapot AI"])
146
  print(f"Using Teapot instance for server: {server_name}")
147
- response, debug_info = await teapot_instance.infer(user_input)
148
- return response, debug_info
149
 
150
 
151
  @client.event
@@ -165,22 +165,17 @@ async def on_message(message):
165
  server_name ="OneTrainer"
166
  async with message.channel.typing():
167
  cleaned_message = message.content.replace(f'<@{client.user.id}>', "").strip()
168
- response, debug_info = await handle_teapot_inference(server_name, cleaned_message)
169
  sent_message = await message.reply(response)
170
 
171
- if is_debug:
172
- thread = await sent_message.create_thread(
173
- name=f"Debug Thread: '{cleaned_message[:80]}'",
174
- auto_archive_duration=60
175
- )
176
- await thread.send(debug_info)
177
 
178
  # ========= STREAMLIT =========
179
  @st.cache_resource
180
- def initialize():
181
  st.session_state["initialized"] = True
182
  client.run(DISCORD_TOKEN)
 
183
  return
184
 
185
- st.write("418 I'm a teapot")
186
- initialize()
 
144
  async def handle_teapot_inference(server_name, user_input):
145
  teapot_instance = CONFIG.get(server_name, CONFIG["Teapot AI"])
146
  print(f"Using Teapot instance for server: {server_name}")
147
+ response = await teapot_instance.query(user_input)
148
+ return response
149
 
150
 
151
  @client.event
 
165
  server_name ="OneTrainer"
166
  async with message.channel.typing():
167
  cleaned_message = message.content.replace(f'<@{client.user.id}>', "").strip()
168
+ response = await handle_teapot_inference(server_name, cleaned_message)
169
  sent_message = await message.reply(response)
170
 
 
 
 
 
 
 
171
 
172
  # ========= STREAMLIT =========
173
  @st.cache_resource
174
+ def discord_loop():
175
  st.session_state["initialized"] = True
176
  client.run(DISCORD_TOKEN)
177
+ st.write("418 I'm a teapot")
178
  return
179
 
180
+
181
+ discord_loop()