fa45d8aa5f
- health_checklist.json: 192.168.1.122→node122
- ocr_client.py: docstring IP→node122
- docs/market-data-requirements.md: IP→node122
- 所有API调用通过ProxyHandler({})绕过系统代理
Privoxy对node122:18003返回500,直连正常
19 lines
773 B
Python
19 lines
773 B
Python
"""Shared helpers for OpenAI-compatible container API URL construction."""
|
|
|
|
import httpx
|
|
|
|
|
|
def join_container_api_base_path(api_base: str, path_suffix: str) -> str:
|
|
"""Append ``path_suffix`` to the path of ``api_base``, keeping the query string last.
|
|
|
|
Azure (and some bases) pass ``api_base`` like
|
|
``https://host/openai/v1/containers?api-version=v1``. Naive string concat would
|
|
produce ``...?api-version=v1/cntr_...`` which is invalid; this uses ``httpx.URL``
|
|
so the result is ``.../containers/cntr_.../files?api-version=v1``.
|
|
"""
|
|
if not path_suffix.startswith("/"):
|
|
path_suffix = f"/{path_suffix}"
|
|
parsed = httpx.URL(api_base)
|
|
new_path = f"{parsed.path.rstrip('/')}{path_suffix}"
|
|
return str(parsed.copy_with(path=new_path))
|