added gemini inference bot

This commit is contained in:
2025-06-02 13:23:02 -05:00
parent 179718595b
commit a24f56531e
5 changed files with 247 additions and 54 deletions
+9 -1
View File
@@ -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)}")