Removed unnecessary awaits

This commit is contained in:
2025-06-02 15:23:20 -05:00
parent c6c8e3ce37
commit 0eed64cbb3
4 changed files with 6 additions and 7 deletions
-1
View File
@@ -66,7 +66,6 @@ class BaseTelegramInferenceBot(ABC):
if user_id in self.conversation_history:
del self.conversation_history[user_id]
# Assuming tool.clear() is for global state or doesn't need user_id
for tool in self.tools:
tool.clear()
+1 -1
View File
@@ -63,7 +63,7 @@ class OpenAICompatibleInferenceBot(BaseTelegramInferenceBot):
tool_calls_from_response.extend(response.choices[0].message.tool_calls)
tool_use_count = 0
MAX_TOOL_ITERATIONS = 5
MAX_TOOL_ITERATIONS = 200
while tool_calls_from_response and tool_use_count < MAX_TOOL_ITERATIONS:
tool_results_for_model = []
+5 -5
View File
@@ -28,7 +28,7 @@ class TelegramHelper:
async def clear(self, update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
user_id = update.effective_user.id
await self.bot.clear_conversation_history(user_id)
self.bot.clear_conversation_history(user_id)
await update.message.reply_text("Conversation history cleared. Let's start fresh!")
async def status(self, update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
@@ -61,13 +61,13 @@ class TelegramHelper:
logging.info(f"Message from user {user_id}: {user_message}")
status_message = await update.message.reply_text("Processing your request...", reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton("Abort", callback_data='abort')]]))\
await self.bot.set_processing_status(user_id, status_message.message_id)
status_message = await update.message.reply_text("Processing your request...", reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton("Abort", callback_data='abort')]]))
self.bot.set_processing_status(user_id, status_message.message_id)
response = await self.bot.handle_message(user_id, user_message)
await context.bot.delete_message(chat_id=update.effective_chat.id, message_id=status_message.message_id)
await self.bot.clear_processing_status(user_id)
self.bot.clear_processing_status(user_id)
response = response.replace("<think>", self.HTML_QUOTE_BLOCK_START).replace("</think>", self.HTML_QUOTE_BLOCK_END)
@@ -126,7 +126,7 @@ class TelegramHelper:
application.add_handler(CommandHandler("status", self.status))
application.add_handler(CommandHandler("reboot", self.reboot))
application.add_handler(CommandHandler("browse", self.browse))
application.add_handler(MessageHandler(filters.TEXT & ~filters.COMMAND, self.handle_message))\
application.add_handler(MessageHandler(filters.TEXT & ~filters.COMMAND, self.handle_message))
application.add_handler(CallbackQueryHandler(self.abort_processing, pattern='^abort$'))
application.add_handler(CallbackQueryHandler(button_callback, pattern='^(browse|file):'))