Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/handlers/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions src/utils/admin_service.py
Original file line number Diff line number Diff line change
@@ -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,
Expand Down