feat: experimental responses api support

This commit is contained in:
Timothy Jaeryang Baek
2026-02-01 19:39:28 -06:00
parent ee5fd1246c
commit ea9c58ea80
3 changed files with 644 additions and 128 deletions

View File

@@ -42,6 +42,7 @@
let prefixId = '';
let enable = true;
let apiVersion = '';
let apiType = ''; // '' = chat completions (default), 'responses' = Responses API
let headers = '';
@@ -183,7 +184,8 @@
connection_type: connectionType,
auth_type,
headers: headers ? JSON.parse(headers) : undefined,
...(!ollama && azure ? { azure: true, api_version: apiVersion } : {})
...(!ollama && azure ? { azure: true, api_version: apiVersion } : {}),
...(apiType ? { api_type: apiType } : {})
}
};
@@ -221,6 +223,7 @@
connectionType = connection.config?.connection_type ?? 'external';
azure = connection.config?.azure ?? false;
apiVersion = connection.config?.api_version ?? '';
apiType = connection.config?.api_type ?? '';
}
}
};
@@ -506,7 +509,7 @@
<div class="flex-1">
<input
id="api-version-input"
class={`w-full text-sm bg-transparent placeholder:text-gray-300 dark:placeholder:text-gray-700 ${($settings?.highContrastMode ?? false) ? 'placeholder:text-gray-700 dark:placeholder:text-gray-100' : 'outline-hidden placeholder:text-gray-300 dark:placeholder:text-gray-700'}`}
class={`w-full text-sm bg-transparent ${($settings?.highContrastMode ?? false) ? 'placeholder:text-gray-700 dark:placeholder:text-gray-100' : 'outline-hidden placeholder:text-gray-300 dark:placeholder:text-gray-700'}`}
type="text"
bind:value={apiVersion}
placeholder={$i18n.t('API Version')}
@@ -518,6 +521,45 @@
</div>
{/if}
{#if !ollama && !direct}
<div class="flex flex-row justify-between items-center w-full mt-1">
<label
for="api-type-toggle"
class={`mb-0.5 text-xs text-gray-500
${($settings?.highContrastMode ?? false) ? 'text-gray-800 dark:text-gray-100' : ''}`}
>{$i18n.t('API Type')}</label
>
<div>
<button
on:click={() => {
apiType = apiType === 'responses' ? '' : 'responses';
}}
type="button"
id="api-type-toggle"
class=" text-xs text-gray-700 dark:text-gray-300"
>
{#if apiType === 'responses'}
<Tooltip
className="flex items-center gap-1"
content={$i18n.t(
'This feature is currently experimental and may not work as expected.'
)}
>
<span class=" text-gray-400 dark:text-gray-600"
>{$i18n.t('Experimental')}</span
>
{$i18n.t('Responses')}
</Tooltip>
{:else}
{$i18n.t('Chat Completions')}
{/if}
</button>
</div>
</div>
{/if}
<div class="flex flex-col w-full mt-2">
<div class="mb-1 flex justify-between">
<div