api: let the openai provider pin chat or responses
ci / checks (push) Successful in 54s
ci / test (push) Successful in 1m0s
ci / chart (push) Successful in 5s
ci / web (push) Successful in 17s
ci / docker (push) Successful in 1m49s
ci / publish-edge-image (push) Successful in 9s
ci / publish-edge-chart (push) Successful in 3s
ci / checks (push) Successful in 54s
ci / test (push) Successful in 1m0s
ci / chart (push) Successful in 5s
ci / web (push) Successful in 17s
ci / docker (push) Successful in 1m49s
ci / publish-edge-image (push) Successful in 9s
ci / publish-edge-chart (push) Successful in 3s
The openai kind already accepts a base URL, and the registry already takes an explicit API choice, but the app always passed none. An OpenAI-compatible server therefore had to answer chat completions. The add-provider dialog now shows an API type for the openai kind: automatic, chat completions, or responses. Automatic keeps the old route rule, Responses at OpenAI itself and chat completions at a base URL; an explicit choice pins either. A separate provider kind would store the same fields and need the same adapter wiring.
This commit is contained in:
1 parent
1289f5f0c2
commit
c67d8af42d
7 files changed
+135
-39
No files matched your search
@@ -23,7 +23,7 @@ const api = useApi()
|
||||
|
||||
const KIND_LABELS: Record<string, string> = {
|
||||
anthropic: 'Anthropic',
|
||||
openai: 'OpenAI',
|
||||
openai: 'OpenAI / compatible',
|
||||
openrouter: 'OpenRouter',
|
||||
google: 'Google Gemini',
|
||||
deepseek: 'DeepSeek',
|
||||
@@ -46,10 +46,12 @@ const loadError = ref('')
|
||||
const providerName = ref('')
|
||||
const providerKind = ref('anthropic')
|
||||
const providerBaseUrl = ref('')
|
||||
const providerApi = ref('')
|
||||
const providerKey = ref('')
|
||||
const providerBusy = ref(false)
|
||||
const providerError = ref('')
|
||||
const llama = computed(() => providerKind.value === 'llama-cpp')
|
||||
const openai = computed(() => providerKind.value === 'openai')
|
||||
const flowKind = computed(() => flowKinds.value.includes(providerKind.value))
|
||||
const kindName = computed(() => KIND_LABELS[providerKind.value] ?? providerKind.value)
|
||||
|
||||
@@ -319,11 +321,13 @@ async function addProvider() {
|
||||
kind: providerKind.value,
|
||||
}
|
||||
if (providerBaseUrl.value.trim()) body.base_url = providerBaseUrl.value.trim()
|
||||
if (openai.value && providerApi.value) body.api = providerApi.value
|
||||
if (!llama.value) body.api_key = providerKey.value
|
||||
try {
|
||||
await api.post<IdResponse>('/provider-configs', body)
|
||||
providerName.value = ''
|
||||
providerBaseUrl.value = ''
|
||||
providerApi.value = ''
|
||||
providerKey.value = ''
|
||||
await loadLists()
|
||||
providerDialog.value = false
|
||||
@@ -446,7 +450,7 @@ async function copyKey(target: SandboxTarget) {
|
||||
<div class="settings-row-main">
|
||||
<div class="settings-row-title">{{ provider.name }}</div>
|
||||
<div class="settings-row-detail">
|
||||
{{ kindLabel(provider.kind) }}<template v-if="provider.base_url">, {{ provider.base_url }}</template>
|
||||
{{ kindLabel(provider.kind) }}<template v-if="provider.api">, {{ provider.api }} API</template><template v-if="provider.base_url">, {{ provider.base_url }}</template>
|
||||
</div>
|
||||
</div>
|
||||
<div class="settings-row-actions">
|
||||
@@ -510,6 +514,21 @@ async function copyKey(target: SandboxTarget) {
|
||||
:required="llama"
|
||||
>
|
||||
<span v-if="llama" class="hint">The address of the llama.cpp server.</span>
|
||||
<span v-else-if="openai" class="hint">
|
||||
Leave empty for OpenAI, or point at any OpenAI-compatible server.
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div v-if="openai" class="field">
|
||||
<label class="field-label" for="provider-api">API type</label>
|
||||
<select id="provider-api" v-model="providerApi" class="select">
|
||||
<option value="">Automatic</option>
|
||||
<option value="chat">Chat completions</option>
|
||||
<option value="responses">Responses</option>
|
||||
</select>
|
||||
<span class="hint">
|
||||
Automatic uses Responses at OpenAI and chat completions when a base URL points elsewhere.
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div v-if="!flowKind && !llama" class="field">
|
||||
|
||||
Reference in new issue
Block a user