From 490278f68023282da758ef6135b19629f16664a5 Mon Sep 17 00:00:00 2001 From: mirivlad Date: Thu, 19 Mar 2026 01:00:42 +0800 Subject: [PATCH] =?UTF-8?q?Fix:=20=D1=83=D0=B4=D0=B0=D0=BB=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20=D0=B2=D1=8B=D0=B7=D0=BE=D0=B2=20get=5Fmode()=20=D0=BF?= =?UTF-8?q?=D0=BE=D1=81=D0=BB=D0=B5=20=D1=83=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D1=8F=20ChatMode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Исправлена ошибка в handle_message - Исправлена ошибка в process_text_as_message - Бот теперь работает с голосовыми сообщениями Co-authored-by: Qwen-Coder --- src/bot/main.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/bot/main.py b/src/bot/main.py index 27384f2..37fd61c 100644 --- a/src/bot/main.py +++ b/src/bot/main.py @@ -434,24 +434,23 @@ async def handle_voice(update: Update, context: ContextTypes.DEFAULT_TYPE): async def process_text_as_message(update: Update, context: ContextTypes.DEFAULT_TYPE, text: str): """Обработка распознанного текста как обычного сообщения""" chat_id = update.effective_chat.id - mode = chat_state.get_mode(chat_id) tool = get_selected_tool() model = get_selected_model() if tool == "opencode" else None - + # Проверяем не ждем ли мы email для XRay if chat_state.get_xray_state(chat_id) == XRayState.WAITING_EMAIL: email = text.strip() await process_xray_email(update, context, email) return - + thinking_msg = await update.message.reply_text("🤔 Думаю...") - + result, success = await orchestrator.ask(text, chat_id, tool, model, yolo=True) - + text_result = result.strip() if result else "" if not text_result: text_result = "⚠️ Пустой ответ от модели." - + text_result = text_result[:4096] await thinking_msg.edit_text(text_result, parse_mode="Markdown") @@ -459,7 +458,6 @@ async def process_text_as_message(update: Update, context: ContextTypes.DEFAULT_ async def handle_message(update: Update, context: ContextTypes.DEFAULT_TYPE): prompt = update.message.text chat_id = update.effective_chat.id - mode = chat_state.get_mode(chat_id) tool = get_selected_tool() model = get_selected_model() if tool == "opencode" else None