fix: включить прокси для embedding-клиента, исправить ошибку 500 на /api/search
Some checks failed
CI / lint-backend (push) Has been cancelled
CI / lint-frontend (push) Has been cancelled
CI / build-backend (push) Has been cancelled
CI / build-frontend (push) Has been cancelled

This commit is contained in:
ed0ss 2026-07-13 18:02:00 +03:00
parent f13b5a4869
commit c0527c9bf6
2 changed files with 14 additions and 6 deletions

View file

@ -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

View file

@ -1,6 +1,6 @@
# API
Базовый URL: `http://<host>/api/v1`
Базовый URL: `http://sovet.itoservice.ru/api/v1`
Авторизация: `Authorization: Bearer <api_key>`