diff --git a/src/handlers/commands.py b/src/handlers/commands.py index 6556b4f..00156c4 100644 --- a/src/handlers/commands.py +++ b/src/handlers/commands.py @@ -83,6 +83,7 @@ async def find_answer(message: types.Message, command: CommandObject): start_time = time.time() + msg = await message.answer(config.get(["messages", "searching"])) chroma_manager = ChromaManager(channel=channel) @@ -114,12 +115,16 @@ async def find_answer(message: types.Message, command: CommandObject): ) query_prompt = QUERY_TEAMPLATE.format(context=context_text, question=query) + + msg_text = "🙋🏼‍♂️ *Ваш вопрос:*\n" + query + "\n\n🔍 *Найденный ответ:*\n" await msg.edit_text(msg_text) response = "" async for stream_response in llm.astream(query_prompt): - if len(stream_response.content) != 0: + + if len(stream_response.content)!=0: + response += stream_response.content msg_text += stream_response.content if (len(msg_text.split()) % 7 == 0) and len(msg_text.split()) >= 7: diff --git a/src/utils/admin_service.py b/src/utils/admin_service.py index ca9a327..cdec039 100644 --- a/src/utils/admin_service.py +++ b/src/utils/admin_service.py @@ -1,12 +1,12 @@ from src.app.loader import bot -from src.config import config +from src.config import config, ADMIN_CHAT_ID from src.utils.markup import inline_markup_admin async def send_to_admins(user_id: int, username: str, first_name: str, last_name: str): if user_id not in config.whitelist: await bot.send_message( - config.admin_ids, + ADMIN_CHAT_ID, f"user_id: {user_id}\nusername: {username}\nfirst_name: {first_name}\nlast_name: {last_name}\n\nРазрешить доступ?", reply_markup=inline_markup_admin(user_id=user_id, username=username), parse_mode=None,