This commit is contained in:
2025-12-23 22:20:42 +03:00
parent 71e8d1079e
commit 493c385cb1
31 changed files with 574 additions and 507 deletions
+3 -5
View File
@@ -2,8 +2,6 @@ import aiohttp
from tg_bot.infrastructure.external.deepseek_client import DeepSeekClient
from tg_bot.config.settings import settings
BACKEND_URL = "http://localhost:8001/api/v1"
class RAGService:
@@ -19,7 +17,7 @@ class RAGService:
try:
async with aiohttp.ClientSession() as session:
async with session.get(
f"{BACKEND_URL}/users/telegram/{user_telegram_id}"
f"{settings.BACKEND_URL}/users/telegram/{user_telegram_id}"
) as user_response:
if user_response.status != 200:
return []
@@ -31,7 +29,7 @@ class RAGService:
return []
async with session.get(
f"{BACKEND_URL}/collections/",
f"{settings.BACKEND_URL}/collections/",
headers={"X-Telegram-ID": user_telegram_id}
) as collections_response:
if collections_response.status != 200:
@@ -48,7 +46,7 @@ class RAGService:
try:
async with aiohttp.ClientSession() as search_session:
async with search_session.get(
f"{BACKEND_URL}/documents/collection/{collection_id}",
f"{settings.BACKEND_URL}/documents/collection/{collection_id}",
params={"search": query, "limit": limit_per_collection},
headers={"X-Telegram-ID": user_telegram_id}
) as search_response: