Co-Authored-By: Sergey Zinchenko <sergey.zinchenko.rnd@gmail.com>
This commit is contained in:
Timothy Jaeryang BaekandSergey Zinchenko committed 2026-05-20 00:26:22 +04:00
1 parent 8a104a7ab1
commit c8f851bd2d
2 files changed
+9 -7

No files matched your search

+5 -5
View File
@@ -595,7 +595,7 @@ async def get_models(request: Request, url_idx: int | None = None, user=Depends(
try: try:
headers, cookies = await get_headers_and_cookies(request, url, key, api_config, user=user) headers, cookies = await get_headers_and_cookies(request, url, key, api_config, user=user)
if api_config.get('azure', False): if api_config.get('azure') or api_config.get('provider') == 'azure':
models = { models = {
'data': api_config.get('model_ids', []) or [], 'data': api_config.get('model_ids', []) or [],
'object': 'list', 'object': 'list',
@@ -681,7 +681,7 @@ async def verify_connection(
try: try:
headers, cookies = await get_headers_and_cookies(request, url, key, api_config, user=user) headers, cookies = await get_headers_and_cookies(request, url, key, api_config, user=user)
if api_config.get('azure', False): if api_config.get('azure') or api_config.get('provider') == 'azure':
# Only set api-key header if not using Azure Entra ID authentication # Only set api-key header if not using Azure Entra ID authentication
auth_type = api_config.get('auth_type', 'bearer') auth_type = api_config.get('auth_type', 'bearer')
if auth_type not in ('azure_ad', 'microsoft_entra_id'): if auth_type not in ('azure_ad', 'microsoft_entra_id'):
@@ -1151,7 +1151,7 @@ async def generate_chat_completion(
is_responses = api_config.get('api_type') == 'responses' is_responses = api_config.get('api_type') == 'responses'
if api_config.get('azure', False): if api_config.get('azure') or api_config.get('provider') == 'azure':
# Only set api-key header if not using Azure Entra ID authentication # Only set api-key header if not using Azure Entra ID authentication
auth_type = api_config.get('auth_type', 'bearer') auth_type = api_config.get('auth_type', 'bearer')
if auth_type not in ('azure_ad', 'microsoft_entra_id'): if auth_type not in ('azure_ad', 'microsoft_entra_id'):
@@ -1408,7 +1408,7 @@ async def responses(
try: try:
headers, cookies = await get_headers_and_cookies(request, url, key, api_config, user=user) headers, cookies = await get_headers_and_cookies(request, url, key, api_config, user=user)
if api_config.get('azure', False): if api_config.get('azure') or api_config.get('provider') == 'azure':
auth_type = api_config.get('auth_type', 'bearer') auth_type = api_config.get('auth_type', 'bearer')
if auth_type not in ('azure_ad', 'microsoft_entra_id'): if auth_type not in ('azure_ad', 'microsoft_entra_id'):
headers['api-key'] = key headers['api-key'] = key
@@ -1519,7 +1519,7 @@ async def proxy(path: str, request: Request, user=Depends(get_verified_user)):
try: try:
headers, cookies = await get_headers_and_cookies(request, url, key, api_config, user=user) headers, cookies = await get_headers_and_cookies(request, url, key, api_config, user=user)
if api_config.get('azure', False): if api_config.get('azure') or api_config.get('provider') == 'azure':
# Only set api-key header if not using Azure Entra ID authentication # Only set api-key header if not using Azure Entra ID authentication
auth_type = api_config.get('auth_type', 'bearer') auth_type = api_config.get('auth_type', 'bearer')
if auth_type not in ('azure_ad', 'microsoft_entra_id'): if auth_type not in ('azure_ad', 'microsoft_entra_id'):
+4 -2
View File
@@ -101,7 +101,8 @@
key, key,
config: { config: {
auth_type, auth_type,
...(provider ? { provider } : azure ? { azure: true } : {}), ...(provider ? { provider } : {}),
...(azure ? { azure: true } : {}),
api_version: apiVersion, api_version: apiVersion,
...(_headers ? { headers: _headers } : {}) ...(_headers ? { headers: _headers } : {})
} }
@@ -189,7 +190,8 @@
connection_type: connectionType, connection_type: connectionType,
auth_type, auth_type,
headers: headers ? JSON.parse(headers) : undefined, headers: headers ? JSON.parse(headers) : undefined,
...(provider ? { provider } : !ollama && azure ? { azure: true } : {}), ...(provider ? { provider } : {}),
...(!ollama && azure ? { azure: true } : {}),
...(azure ? { api_version: apiVersion } : {}), ...(azure ? { api_version: apiVersion } : {}),
...(apiType ? { api_type: apiType } : {}) ...(apiType ? { api_type: apiType } : {})
} }