forked from vhaudiquet/rhema-together
feat: add providers without a default model
The add-provider form asked for a model even though the room owns that choice. It now asks for a name, kind, base URL, and key. New providers store no default, and New room requires a model before it can submit. Existing providers keep their model as an optional default. The model picker hides the Provider default row when there is none, and a room with no usable model gets a clear error instead of an empty model reaching the provider.
This commit is contained in:
1 parent
2216f37422
commit
369075a842
10 files changed
+48
-33
No files matched your search
@@ -27,7 +27,6 @@ const loadError = ref('')
|
||||
|
||||
const providerName = ref('')
|
||||
const providerKind = ref('anthropic')
|
||||
const providerModel = ref('')
|
||||
const providerBaseUrl = ref('')
|
||||
const providerKey = ref('')
|
||||
const providerBusy = ref(false)
|
||||
@@ -103,14 +102,12 @@ async function addProvider() {
|
||||
const body: CreateProviderBody = {
|
||||
name: providerName.value.trim(),
|
||||
kind: providerKind.value,
|
||||
model: providerModel.value.trim(),
|
||||
}
|
||||
if (providerBaseUrl.value.trim()) body.base_url = providerBaseUrl.value.trim()
|
||||
if (!llama.value) body.api_key = providerKey.value
|
||||
try {
|
||||
await api.post<IdResponse>('/provider-configs', body)
|
||||
providerName.value = ''
|
||||
providerModel.value = ''
|
||||
providerBaseUrl.value = ''
|
||||
providerKey.value = ''
|
||||
await loadLists()
|
||||
@@ -225,7 +222,7 @@ async function copyKey(target: SandboxTarget) {
|
||||
Add provider
|
||||
</button>
|
||||
</div>
|
||||
<p class="hint">A provider holds the model backend and key. Rooms spend from the provider their owner picks.</p>
|
||||
<p class="hint">A provider holds a backend and key. Each room picks a model from its provider.</p>
|
||||
|
||||
<div v-if="!loading && providers.length === 0" class="empty">No providers yet. Use Add provider to connect one.</div>
|
||||
|
||||
@@ -234,8 +231,7 @@ async function copyKey(target: SandboxTarget) {
|
||||
<div class="settings-row-main">
|
||||
<div class="settings-row-title">{{ provider.name }}</div>
|
||||
<div class="settings-row-detail">
|
||||
{{ provider.kind }}, {{ provider.model }}
|
||||
<template v-if="provider.base_url">, {{ provider.base_url }}</template>
|
||||
{{ provider.kind }}<template v-if="provider.base_url">, {{ provider.base_url }}</template>
|
||||
</div>
|
||||
</div>
|
||||
<div class="settings-row-actions">
|
||||
@@ -284,11 +280,6 @@ async function copyKey(target: SandboxTarget) {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label class="field-label" for="provider-model">Model</label>
|
||||
<input id="provider-model" v-model="providerModel" class="input" type="text" spellcheck="false" required>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label class="field-label" for="provider-base">
|
||||
{{ llama ? 'Server URL' : 'Base URL' }}
|
||||
|
||||
Reference in new issue
Block a user