added gemini inference bot
This commit is contained in:
+9
-1
@@ -65,7 +65,15 @@ class TelegramHelper:
|
||||
del self.bot.processing_status[user_id]
|
||||
response = response.replace("<think>", "<blockquote expandable><b>Thinking...</b>").replace("</think>", "</blockquote>")
|
||||
# Return response as html message
|
||||
await update.message.reply_html(response)
|
||||
if len(response) > 4096:
|
||||
# If the response is too long, split it into chunks
|
||||
chunks = [response[i:i + 4096] for i in range(0, len(response), 4096)]
|
||||
for chunk in chunks:
|
||||
await update.message.reply_text(chunk)
|
||||
# Add a small delay to avoid flooding
|
||||
await asyncio.sleep(0.1)
|
||||
else:
|
||||
await update.message.reply_text(response)
|
||||
|
||||
except Exception as e:
|
||||
logging.error(f"An error occurred: {str(e)}")
|
||||
|
||||
Reference in New Issue
Block a user