randydev commited on
Commit
4d59b93
1 Parent(s): d86d5e9

Update chatbot/plugins/chat.py

Browse files
Files changed (1) hide show
  1. chatbot/plugins/chat.py +6 -0
chatbot/plugins/chat.py CHANGED
@@ -86,6 +86,8 @@ async def chatbot_talk(client: Client, message: Message):
86
  else:
87
  ai_reply = await message.reply_text(f"Processing...")
88
  try:
 
 
89
  backup_chat = await db._get_chatbot_chat_from_db(message.from_user.id)
90
  backup_chat.append({"role": "user", "parts": [{"text": caption}]})
91
  response_reads = x.get_response_image(caption, file_path)
@@ -152,6 +154,8 @@ async def chatbot_talk(client: Client, message: Message):
152
  if audio_file.state.name == "FAILED":
153
  return await ai_reply.edit_text(f"Error: {audio_file.state.name}")
154
  try:
 
 
155
  response = model.generate_content(
156
  [audio_file, caption],
157
  request_options={"timeout": 600}
@@ -217,6 +221,8 @@ async def chatbot_talk(client: Client, message: Message):
217
  if video_file.state.name == "FAILED":
218
  return await ai_reply.edit_text(f"Error: {video_file.state.name}")
219
  try:
 
 
220
  response = model.generate_content(
221
  [video_file, caption],
222
  request_options={"timeout": 600}
 
86
  else:
87
  ai_reply = await message.reply_text(f"Processing...")
88
  try:
89
+ await client.send_chat_action(message.chat.id, enums.ChatAction.TYPING)
90
+ await asyncio.sleep(1.5)
91
  backup_chat = await db._get_chatbot_chat_from_db(message.from_user.id)
92
  backup_chat.append({"role": "user", "parts": [{"text": caption}]})
93
  response_reads = x.get_response_image(caption, file_path)
 
154
  if audio_file.state.name == "FAILED":
155
  return await ai_reply.edit_text(f"Error: {audio_file.state.name}")
156
  try:
157
+ await client.send_chat_action(message.chat.id, enums.ChatAction.TYPING)
158
+ await asyncio.sleep(1.5)
159
  response = model.generate_content(
160
  [audio_file, caption],
161
  request_options={"timeout": 600}
 
221
  if video_file.state.name == "FAILED":
222
  return await ai_reply.edit_text(f"Error: {video_file.state.name}")
223
  try:
224
+ await client.send_chat_action(message.chat.id, enums.ChatAction.TYPING)
225
+ await asyncio.sleep(1.5)
226
  response = model.generate_content(
227
  [video_file, caption],
228
  request_options={"timeout": 600}