refac
Co-Authored-By: Sergey Zinchenko <sergey.zinchenko.rnd@gmail.com>
This commit is contained in:
co-authored by
Sergey Zinchenko
parent
8a104a7ab1
commit
c8f851bd2d
@@ -595,7 +595,7 @@ async def get_models(request: Request, url_idx: int | None = None, user=Depends(
|
||||
try:
|
||||
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 = {
|
||||
'data': api_config.get('model_ids', []) or [],
|
||||
'object': 'list',
|
||||
@@ -681,7 +681,7 @@ async def verify_connection(
|
||||
try:
|
||||
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
|
||||
auth_type = api_config.get('auth_type', 'bearer')
|
||||
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'
|
||||
|
||||
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
|
||||
auth_type = api_config.get('auth_type', 'bearer')
|
||||
if auth_type not in ('azure_ad', 'microsoft_entra_id'):
|
||||
@@ -1408,7 +1408,7 @@ async def responses(
|
||||
try:
|
||||
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')
|
||||
if auth_type not in ('azure_ad', 'microsoft_entra_id'):
|
||||
headers['api-key'] = key
|
||||
@@ -1519,7 +1519,7 @@ async def proxy(path: str, request: Request, user=Depends(get_verified_user)):
|
||||
try:
|
||||
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
|
||||
auth_type = api_config.get('auth_type', 'bearer')
|
||||
if auth_type not in ('azure_ad', 'microsoft_entra_id'):
|
||||
|
||||
@@ -101,7 +101,8 @@
|
||||
key,
|
||||
config: {
|
||||
auth_type,
|
||||
...(provider ? { provider } : azure ? { azure: true } : {}),
|
||||
...(provider ? { provider } : {}),
|
||||
...(azure ? { azure: true } : {}),
|
||||
api_version: apiVersion,
|
||||
...(_headers ? { headers: _headers } : {})
|
||||
}
|
||||
@@ -189,7 +190,8 @@
|
||||
connection_type: connectionType,
|
||||
auth_type,
|
||||
headers: headers ? JSON.parse(headers) : undefined,
|
||||
...(provider ? { provider } : !ollama && azure ? { azure: true } : {}),
|
||||
...(provider ? { provider } : {}),
|
||||
...(!ollama && azure ? { azure: true } : {}),
|
||||
...(azure ? { api_version: apiVersion } : {}),
|
||||
...(apiType ? { api_type: apiType } : {})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user