From c0527c9bf6da6120663f22548b97e0d9b8f629b0 Mon Sep 17 00:00:00 2001 From: ed0ss Date: Mon, 13 Jul 2026 18:02:00 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20=D0=B2=D0=BA=D0=BB=D1=8E=D1=87=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20=D0=BF=D1=80=D0=BE=D0=BA=D1=81=D0=B8=20=D0=B4?= =?UTF-8?q?=D0=BB=D1=8F=20embedding-=D0=BA=D0=BB=D0=B8=D0=B5=D0=BD=D1=82?= =?UTF-8?q?=D0=B0,=20=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D1=83=20500=20=D0=BD?= =?UTF-8?q?=D0=B0=20/api/search?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/services/embedding.py | 18 +++++++++++++----- docs/API.md | 2 +- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/backend/app/services/embedding.py b/backend/app/services/embedding.py index fc790bd..5a1409d 100644 --- a/backend/app/services/embedding.py +++ b/backend/app/services/embedding.py @@ -16,14 +16,22 @@ _client: httpx.AsyncClient | None = None def get_client() -> httpx.AsyncClient: global _client if _client is None: - _client = httpx.AsyncClient( - base_url=OPENROUTER_BASE, - headers={ + kwargs: dict = { + "base_url": OPENROUTER_BASE, + "headers": { "Authorization": f"Bearer {settings.openrouter_api_key}", "Content-Type": "application/json", }, - timeout=30, - ) + "timeout": 30, + } + if settings.proxy_url: + proxy = settings.proxy_url + if not proxy.startswith(("http://", "https://")): + proxy = "http://" + proxy + if settings.proxy_login and settings.proxy_pass: + proxy = proxy.replace("://", f"://{settings.proxy_login}:{settings.proxy_pass}@") + kwargs["proxy"] = proxy + _client = httpx.AsyncClient(**kwargs) return _client diff --git a/docs/API.md b/docs/API.md index 38920c5..b30ffea 100644 --- a/docs/API.md +++ b/docs/API.md @@ -1,6 +1,6 @@ # API -Базовый URL: `http:///api/v1` +Базовый URL: `http://sovet.itoservice.ru/api/v1` Авторизация: `Authorization: Bearer `