feat: azure openai connections ui

This commit is contained in:
Timothy Jaeryang Baek 2025-05-19 03:29:14 +04:00
parent 73e64fe7fb
commit 47f8b3500b

View File

@ -32,9 +32,13 @@
let connectionType = 'external';
let azure = false;
$: azure =
url.includes('openai.azure.com') || url.includes('cognitive.microsoft.com') ? true : false;
let prefixId = '';
let enable = true;
let apiVersion = '';
let tags = [];
let modelId = '';
@ -100,7 +104,7 @@
prefix_id: prefixId,
model_ids: modelIds,
connection_type: connectionType,
...(!ollama && azure ? { azure: true } : {})
...(!ollama && azure ? { azure: true, api_version: apiVersion } : {})
}
};
@ -286,6 +290,27 @@
</div>
</div>
{#if azure}
<div class="flex gap-2 mt-2">
<div class="flex flex-col w-full">
<div class=" mb-1 text-xs text-gray-500">{$i18n.t('API Version')}</div>
<div class="flex-1">
<Tooltip content={$i18n.t('Specify the API version to use')}>
<input
class="w-full text-sm bg-transparent placeholder:text-gray-300 dark:placeholder:text-gray-700 outline-hidden"
type="text"
bind:value={apiVersion}
placeholder={$i18n.t('API Version')}
autocomplete="off"
required
/>
</Tooltip>
</div>
</div>
</div>
{/if}
<div class="flex gap-2 mt-2">
<div class="flex flex-col w-full">
<div class=" mb-1.5 text-xs text-gray-500">{$i18n.t('Tags')}</div>
@ -342,6 +367,13 @@
{$i18n.t('Leave empty to include all models from "{{url}}/api/tags" endpoint', {
url: url
})}
{:else if azure}
{$i18n.t(
'Leave empty to include all models from "{{url}}/openai/deployments" endpoint',
{
url: url
}
)}
{:else}
{$i18n.t('Leave empty to include all models from "{{url}}/models" endpoint', {
url: url