fix: включить прокси для embedding-клиента, исправить ошибку 500 на /api/search
This commit is contained in:
parent
f13b5a4869
commit
c0527c9bf6
2 changed files with 14 additions and 6 deletions
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# API
|
||||
|
||||
Базовый URL: `http://<host>/api/v1`
|
||||
Базовый URL: `http://sovet.itoservice.ru/api/v1`
|
||||
|
||||
Авторизация: `Authorization: Bearer <api_key>`
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue