This commit is contained in:
Timothy Jaeryang Baek
2026-05-09 01:13:16 +09:00
parent a32d26e61d
commit 4fe2de7864
8 changed files with 222 additions and 36 deletions
+17 -15
View File
@@ -36,9 +36,10 @@
let auth_type = 'bearer';
let connectionType = 'external';
let azure = false;
let provider = '';
$: azure =
(url.includes('azure.') || url.includes('cognitive.microsoft.com')) && !direct ? true : false;
provider === 'azure' ||
((url.includes('azure.') || url.includes('cognitive.microsoft.com')) && !direct && provider === '');
let prefixId = '';
let enable = true;
@@ -98,7 +99,7 @@
key,
config: {
auth_type,
azure: azure,
...(provider ? { provider } : azure ? { azure: true } : {}),
api_version: apiVersion,
...(_headers ? { headers: _headers } : {})
}
@@ -186,7 +187,8 @@
connection_type: connectionType,
auth_type,
headers: headers ? JSON.parse(headers) : undefined,
...(!ollama && azure ? { azure: true, api_version: apiVersion } : {}),
...(provider ? { provider } : !ollama && azure ? { azure: true } : {}),
...(azure ? { api_version: apiVersion } : {}),
...(apiType ? { api_type: apiType } : {})
}
};
@@ -223,7 +225,7 @@
connectionType = connection.config?.connection_type ?? 'local';
} else {
connectionType = connection.config?.connection_type ?? 'external';
azure = connection.config?.azure ?? false;
provider = connection.config?.provider ?? (connection.config?.azure ? 'azure' : '');
apiVersion = connection.config?.api_version ?? '';
apiType = connection.config?.api_type ?? '';
}
@@ -491,22 +493,22 @@
{#if !ollama && !direct}
<div class="flex flex-row justify-between items-center w-full mt-2">
<label
for="prefix-id-input"
for="provider-select"
class={`mb-0.5 text-xs text-gray-500
${($settings?.highContrastMode ?? false) ? 'text-gray-800 dark:text-gray-100' : ''}`}
>{$i18n.t('Provider Type')}</label
>{$i18n.t('Provider')}</label
>
<div>
<button
on:click={() => {
azure = !azure;
}}
type="button"
class=" text-xs text-gray-700 dark:text-gray-300"
<select
id="provider-select"
bind:value={provider}
class="text-xs text-gray-700 dark:text-gray-300 bg-transparent outline-hidden"
>
{azure ? $i18n.t('Azure OpenAI') : $i18n.t('OpenAI')}
</button>
<option value="">{$i18n.t('Default')}</option>
<option value="azure">{$i18n.t('Azure OpenAI')}</option>
<option value="llama.cpp">{$i18n.t('llama.cpp')}</option>
</select>
</div>
</div>
{/if}