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
@@ -36,12 +36,19 @@ const pickerOpen = ref(false)
|
||||
const selectedProvider = computed(
|
||||
() => providers.value.find((provider) => provider.id === providerId.value) ?? null,
|
||||
)
|
||||
const effectiveModel = computed(() => model.value.trim() || selectedProvider.value?.model || '')
|
||||
|
||||
const submitting = ref(false)
|
||||
const error = ref('')
|
||||
|
||||
const canSubmit = computed(
|
||||
() => !loading.value && !submitting.value && !!name.value.trim() && !!providerId.value && !!targetId.value,
|
||||
() =>
|
||||
!loading.value &&
|
||||
!submitting.value &&
|
||||
!!name.value.trim() &&
|
||||
!!providerId.value &&
|
||||
!!targetId.value &&
|
||||
!!effectiveModel.value,
|
||||
)
|
||||
|
||||
const missing = computed(() => {
|
||||
@@ -94,7 +101,7 @@ async function submit() {
|
||||
}
|
||||
if (workspace.value.trim()) body.workspace = workspace.value.trim()
|
||||
if (repoUrl.value.trim()) body.repo_url = repoUrl.value.trim()
|
||||
if (model.value.trim()) body.model = model.value.trim()
|
||||
body.model = effectiveModel.value
|
||||
try {
|
||||
const response = await api.post<CreateRoomResponse>('/rooms', body)
|
||||
await rooms.refresh()
|
||||
@@ -159,7 +166,7 @@ async function submit() {
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<span class="field-label">Model <span class="field-optional">optional</span></span>
|
||||
<span class="field-label">Model</span>
|
||||
<button
|
||||
type="button"
|
||||
class="model-trigger"
|
||||
@@ -170,12 +177,12 @@ async function submit() {
|
||||
@click="pickerOpen = true"
|
||||
>
|
||||
<span class="model-trigger-value">
|
||||
<span class="model-trigger-name">{{ model || selectedProvider?.model || 'Select a model' }}</span>
|
||||
<span v-if="selectedProvider && !model" class="model-trigger-note">Provider default</span>
|
||||
<span class="model-trigger-name">{{ effectiveModel || 'Select a model' }}</span>
|
||||
<span v-if="!model && selectedProvider?.model" class="model-trigger-note">Provider default</span>
|
||||
</span>
|
||||
<ChevronRight :size="16" aria-hidden="true" />
|
||||
</button>
|
||||
<span class="hint">The room uses the provider's model unless you pick another.</span>
|
||||
<span class="hint">{{ effectiveModel ? 'The room uses this model for every turn.' : 'Pick a model for the room.' }}</span>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
|
||||
Reference in new issue
Block a user