patch chat

This commit is contained in:
unknown 2025-09-30 00:40:08 +03:00
parent 54e4d3542e
commit 6f8bc0e762
3 changed files with 20 additions and 2 deletions

17
app/core/http_client.py Normal file
View File

@ -0,0 +1,17 @@
import ssl
import httpx
ssl_transport = httpx.AsyncHTTPTransport(http2=True)
# Ограничения пула соединений
limits = httpx.Limits(max_connections=200, max_keepalive_connections=50)
# Таймауты
timeout = httpx.Timeout(connect=5.0, read=10.0, write=5.0, pool=5.0)
# Глобальный клиент
client = httpx.AsyncClient(
transport=ssl_transport,
limits=limits,
timeout=timeout,
)

View File

@ -32,7 +32,8 @@ async def get_private_chats(token: str, offset: int = 0, limit: int = 20):
if data.get("status") == "fine":
# Используем Pydantic модель для парсинга ответа
response_model = PrivateChatListResponse(**data)
print("response_model.data", response_model.data)
# print("response_model.data", response_model.data)
print("data", data)
return True, response_model.data
else:
return False, data.get("detail", localizer.translate("Неизвестная ошибка ответа"))