feat(ui): suggest input on Combobox replaces datalists, RadioGroup for task pickers
Also records the combobox and radio-group components added in 63476393.
This commit is contained in:
1 parent
63476393d7
commit
ca597c3678
16 files changed
+192
-165
No files matched your search
@@ -9,6 +9,7 @@ import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@/
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Field, FieldContent, FieldDescription, FieldGroup, FieldLabel } from "@/components/ui/field";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { SuggestInput } from "@/components/ui/suggest-input";
|
||||
import {
|
||||
Select,
|
||||
SelectContent,
|
||||
@@ -138,7 +139,6 @@ interface OrgPolicy {
|
||||
}
|
||||
const policies = computed(() => store.draftValue("org-model-policy") as Record<string, OrgPolicy> | undefined);
|
||||
const otherOrgs = computed(() => (orgStore.instanceAdmin ? orgStore.orgs.filter((o) => o.id !== "org-sys") : []));
|
||||
const providerWildcards = computed(() => configuredIds.value.map((id) => `${id}/*`));
|
||||
function policyFor(id: string): OrgPolicy {
|
||||
return policies.value?.[id] ?? { allowed: [], own_providers: false };
|
||||
}
|
||||
@@ -166,9 +166,6 @@ function setAllowed(id: string, text: string) {
|
||||
</p>
|
||||
|
||||
<template v-if="aliases">
|
||||
<datalist id="alias-models">
|
||||
<option v-for="m in modelOptions" :key="m" :value="m" />
|
||||
</datalist>
|
||||
<Section title="Aliases">
|
||||
<p v-if="!aliases.default" class="mb-3 text-sm text-warn" role="alert">Set the default alias.</p>
|
||||
<div v-for="alias in aliasNames" :key="alias" class="flex flex-wrap items-center gap-3 border-b border-border py-2.5 last-of-type:border-b-0">
|
||||
@@ -191,10 +188,10 @@ function setAllowed(id: string, text: string) {
|
||||
<span v-if="!embeddingProviders.length" class="text-xs text-fg-subtle">Needs an openai, gemini, ollama, cohere or mistral provider.</span>
|
||||
</template>
|
||||
<template v-else>
|
||||
<Input
|
||||
<SuggestInput
|
||||
:id="`alias-${alias}`"
|
||||
:model-value="aliases[alias] ?? ''"
|
||||
list="alias-models"
|
||||
:options="modelOptions"
|
||||
class="min-w-0 max-w-md flex-1 font-mono max-sm:max-w-none max-sm:basis-full"
|
||||
placeholder="unset"
|
||||
:aria-invalid="!!aliasIssue(alias)"
|
||||
@@ -216,15 +213,11 @@ function setAllowed(id: string, text: string) {
|
||||
</template>
|
||||
|
||||
<template v-if="policies && otherOrgs.length">
|
||||
<datalist id="org-allowed">
|
||||
<option v-for="m in [...providerWildcards, ...modelOptions]" :key="m" :value="m" />
|
||||
</datalist>
|
||||
<Section title="Org access">
|
||||
<div v-for="o in otherOrgs" :key="o.id" class="flex flex-wrap items-center gap-3 border-b border-border py-2.5 last-of-type:border-b-0">
|
||||
<span class="w-28 truncate text-sm font-medium max-sm:w-full" :title="o.id">{{ o.name }}</span>
|
||||
<Input
|
||||
:model-value="allowedText(o.id)"
|
||||
list="org-allowed"
|
||||
class="min-w-0 max-w-md flex-1 font-mono max-sm:max-w-none max-sm:basis-full"
|
||||
placeholder="no models"
|
||||
:aria-label="`Models ${o.name} may use`"
|
||||
@@ -239,9 +232,6 @@ function setAllowed(id: string, text: string) {
|
||||
</template>
|
||||
|
||||
<template v-if="providers">
|
||||
<datalist id="available-providers">
|
||||
<option v-for="p in available" :key="p.id" :value="p.id">{{ p.name }}</option>
|
||||
</datalist>
|
||||
<Section title="Providers">
|
||||
<Accordion type="multiple">
|
||||
<AccordionItem v-for="[name, provider] in providerEntries" :key="name" :value="name">
|
||||
@@ -317,7 +307,7 @@ function setAllowed(id: string, text: string) {
|
||||
</AccordionItem>
|
||||
</Accordion>
|
||||
<form class="flex flex-wrap items-center gap-2 border-t border-border pt-3" @submit.prevent="addProvider">
|
||||
<Input v-model="newProvider" list="available-providers" class="max-w-56 font-mono" placeholder="provider" aria-label="New provider" />
|
||||
<SuggestInput v-model="newProvider" :options="available.map((p) => p.id)" class="max-w-56 font-mono" placeholder="provider" aria-label="New provider" />
|
||||
<Button type="submit" variant="outline" size="sm" :disabled="!newProvider.trim()"><Plus data-icon="inline-start" />Add provider</Button>
|
||||
<span v-if="available.length" class="text-xs text-fg-subtle">Available:
|
||||
<Button v-for="p in available" :key="p.id" type="button" variant="link" size="xs" class="h-auto px-1 font-mono text-fg-subtle" @click="newProvider = p.id; addProvider()">{{ p.id }}</Button>
|
||||
|
||||
Reference in new issue
Block a user