feat: Allow Azure OpenAI to authenticate using DefaultAzureCredential

Co-Authored-By: Selene Blok <20491756+selenecodes@users.noreply.github.com>
This commit is contained in:
Timothy Jaeryang Baek
2025-09-17 11:04:47 -05:00
parent 72cd3a54f7
commit caf0a1fbb6
2 changed files with 49 additions and 11 deletions

View File

@@ -122,7 +122,7 @@
return;
}
if (!key) {
if (!key && !['azure_ad', 'azure_entra_id'].includes(auth_type)) {
loading = false;
toast.error($i18n.t('Key is required'));
@@ -331,6 +331,9 @@
<option value="session">{$i18n.t('Session')}</option>
{#if !direct}
<option value="system_oauth">{$i18n.t('OAuth')}</option>
{#if azure}
<option value="azure_entra_id">{$i18n.t('Azure Entra ID')}</option>
{/if}
{/if}
{/if}
</select>
@@ -361,6 +364,12 @@
>
{$i18n.t('Forwards system user OAuth access token to authenticate')}
</div>
{:else if ['azure_ad', 'azure_entra_id'].includes(auth_type)}
<div
class={`text-xs self-center translate-y-[1px] ${($settings?.highContrastMode ?? false) ? 'text-gray-800 dark:text-gray-100' : 'text-gray-500'}`}
>
{$i18n.t('Uses DefaultAzureCredential to authenticate')}
</div>
{/if}
</div>
</div>
@@ -443,7 +452,7 @@
</div>
{/if}
<div class="flex flex-col w-full">
<div class="flex flex-col w-full mt-2">
<div class="mb-1 flex justify-between">
<div
class={`mb-0.5 text-xs text-gray-500
@@ -499,8 +508,6 @@
{/if}
</div>
<hr class=" border-gray-100 dark:border-gray-700/10 my-1.5 w-full" />
<div class="flex items-center">
<label class="sr-only" for="add-model-id-input">{$i18n.t('Add a model ID')}</label>
<input
@@ -528,9 +535,7 @@
</div>
</div>
<hr class=" border-gray-50 dark:border-gray-850 my-2.5 w-full" />
<div class="flex gap-2">
<div class="flex gap-2 mt-2">
<div class="flex flex-col w-full">
<div
class={`mb-0.5 text-xs text-gray-500