Fix: удалить вызов get_mode() после удаления ChatMode

- Исправлена ошибка в handle_message
- Исправлена ошибка в process_text_as_message
- Бот теперь работает с голосовыми сообщениями

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
mirivlad 2026-03-19 01:00:42 +08:00
parent 6b21889964
commit 490278f680
1 changed files with 5 additions and 7 deletions

View File

@ -434,7 +434,6 @@ async def handle_voice(update: Update, context: ContextTypes.DEFAULT_TYPE):
async def process_text_as_message(update: Update, context: ContextTypes.DEFAULT_TYPE, text: str): async def process_text_as_message(update: Update, context: ContextTypes.DEFAULT_TYPE, text: str):
"""Обработка распознанного текста как обычного сообщения""" """Обработка распознанного текста как обычного сообщения"""
chat_id = update.effective_chat.id chat_id = update.effective_chat.id
mode = chat_state.get_mode(chat_id)
tool = get_selected_tool() tool = get_selected_tool()
model = get_selected_model() if tool == "opencode" else None model = get_selected_model() if tool == "opencode" else None
@ -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): async def handle_message(update: Update, context: ContextTypes.DEFAULT_TYPE):
prompt = update.message.text prompt = update.message.text
chat_id = update.effective_chat.id chat_id = update.effective_chat.id
mode = chat_state.get_mode(chat_id)
tool = get_selected_tool() tool = get_selected_tool()
model = get_selected_model() if tool == "opencode" else None model = get_selected_model() if tool == "opencode" else None