fix(ui): known lists use Select/TagsInput fed by the server catalogue (#1760)
Token lifetimes use Select instead of NativeSelect. Credential bindings pick service from the store's credentialServices and organisation from the org list (empty = default, via a sentinel). Curator and agent-profile tools are TagsInput instead of comma text; curator model is a Select of the configured providers' models from /api/config's catalog. Org and system model pages pick provider class from the catalog's classes, and SystemModelsPage's local CLASSES list is deleted. Chat model choice is a Select of the server-served model list instead of a button row. Left as free text because no server source exists: policy object kind, curator memory engine, update channel labels, connection type default, container default, step titles (x-step-types carries no titles).
This commit is contained in:
7 files changed
+98
-45
No files matched your search
@@ -5,7 +5,7 @@ import { Copy, Plus, X } from "@lucide/vue";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { NativeSelect, NativeSelectOption } from "@/components/ui/native-select";
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
||||
import { api } from "@/lib/api";
|
||||
import { Section } from "@/components/ui/section";
|
||||
import { Timestamp } from "@/components/ui/timestamp";
|
||||
@@ -75,9 +75,12 @@ onMounted(load);
|
||||
<template v-if="available" #action>
|
||||
<form class="flex items-center gap-2" @submit.prevent="create">
|
||||
<Input v-model="name" class="w-40" maxlength="40" required placeholder="Name" aria-label="Token name" />
|
||||
<NativeSelect v-model="days" size="sm" aria-label="Lifetime">
|
||||
<NativeSelectOption v-for="option in lifetimes" :key="option.days" :value="option.days">{{ option.label }}</NativeSelectOption>
|
||||
</NativeSelect>
|
||||
<Select :model-value="String(days)" @update:model-value="(v) => (days = Number(v))">
|
||||
<SelectTrigger size="sm" class="w-28" aria-label="Lifetime"><SelectValue /></SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem v-for="option in lifetimes" :key="option.days" :value="String(option.days)">{{ option.label }}</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<Button type="submit" size="sm" :disabled="busy || !name.trim()"><Plus data-icon="inline-start" />New token</Button>
|
||||
</form>
|
||||
</template>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from "vue";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
||||
import { selectorData, setModel } from "./state";
|
||||
|
||||
defineProps<{ choose: "model" }>();
|
||||
@@ -13,16 +13,11 @@ const options = computed(() => selectorData.value.models ?? []);
|
||||
<div class="text-sm">
|
||||
<p class="font-medium">Choose a model</p>
|
||||
<p v-if="!options.length" class="mt-1 text-fg-muted">None configured.</p>
|
||||
<div v-else class="mt-2 flex flex-wrap gap-2">
|
||||
<Button
|
||||
v-for="option in options"
|
||||
:key="option"
|
||||
size="sm"
|
||||
:variant="option === selectorData.active_model ? 'default' : 'outline'"
|
||||
class="font-mono"
|
||||
@click="void setModel(option)"
|
||||
>{{ option }}</Button
|
||||
>
|
||||
</div>
|
||||
<Select v-else :model-value="selectorData.active_model" class="mt-2" @update:model-value="(v) => void setModel(String(v))">
|
||||
<SelectTrigger class="w-full font-mono" aria-label="Model"><SelectValue placeholder="Choose a model" /></SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem v-for="option in options" :key="option" :value="option" class="font-mono">{{ option }}</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
</template>
|
||||
@@ -9,7 +9,10 @@ import { Switch } from "@/components/ui/switch";
|
||||
import { DurationInput } from "@/components/ui/duration-input";
|
||||
import { Section } from "@/components/ui/section";
|
||||
import { Field, FieldContent, FieldGroup, FieldLabel } from "@/components/ui/field";
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
||||
import { TagsInput, TagsInputInput, TagsInputItem, TagsInputItemDelete, TagsInputItemText } from "@/components/ui/tags-input";
|
||||
import { useSettingsStore } from "@/stores/settings";
|
||||
import { aliasModelOptions } from "@/settings/model-choices";
|
||||
import ApplyStatusRows from "@/settings/ApplyStatusRows.vue";
|
||||
import HistoryLink from "@/settings/HistoryLink.vue";
|
||||
import PageHeader from "@/base/PageHeader.vue";
|
||||
@@ -35,7 +38,10 @@ interface Definition {
|
||||
}
|
||||
const KIND = "curators";
|
||||
const store = useSettingsStore();
|
||||
onMounted(store.load);
|
||||
onMounted(() => {
|
||||
void store.load();
|
||||
void store.loadConfig();
|
||||
});
|
||||
const form = computed(() => store.formFor(KIND));
|
||||
const definitions = computed(() => store.draftValue(KIND) as Definition[] | null);
|
||||
const editing = ref(false);
|
||||
@@ -52,9 +58,13 @@ function add() {
|
||||
function remove(index: number) {
|
||||
store.setDraftValue(KIND, (definitions.value ?? []).filter((_, i) => i !== index));
|
||||
}
|
||||
function toolsFromText(value: string | number): string[] {
|
||||
return String(value).split(",").map(tool => tool.trim()).filter(Boolean);
|
||||
}
|
||||
// Models are the configured providers' models from the server's catalog, plus
|
||||
// whatever the draft already names.
|
||||
const modelCatalog = computed(() => store.config?.catalog ?? []);
|
||||
const configuredProviderIds = computed(() =>
|
||||
Object.keys((store.draftValue("provider-settings") as Record<string, unknown> | undefined) ?? {}),
|
||||
);
|
||||
const modelOptions = computed(() => aliasModelOptions(modelCatalog.value, configuredProviderIds.value));
|
||||
watch(() => store.applyStatusFor(KIND).map(row => row.version).join(","), () => void load());
|
||||
const curators = ref<Curator[]>([]);
|
||||
const loadError = ref<string | null>(null);
|
||||
@@ -133,12 +143,19 @@ onMounted(load);
|
||||
<Field orientation="responsive">
|
||||
<FieldContent><FieldLabel :for="`curator-${index}-tools`">Tools</FieldLabel></FieldContent>
|
||||
<div class="flex min-w-0 flex-wrap items-center gap-3 @md/field-group:flex-1">
|
||||
<Input
|
||||
<TagsInput
|
||||
:id="`curator-${index}-tools`"
|
||||
:model-value="(field.state.value ?? []).join(', ')"
|
||||
@blur="field.handleBlur"
|
||||
@update:model-value="(value) => field.handleChange(toolsFromText(value))"
|
||||
/>
|
||||
class="flex-1"
|
||||
:model-value="(field.state.value ?? [])"
|
||||
:aria-label="`${def.name} tools`"
|
||||
@update:model-value="(value) => field.handleChange(value.map(String))"
|
||||
>
|
||||
<TagsInputItem v-for="tool in field.state.value ?? []" :key="tool" :value="tool">
|
||||
<TagsInputItemText />
|
||||
<TagsInputItemDelete />
|
||||
</TagsInputItem>
|
||||
<TagsInputInput placeholder="Add tool" />
|
||||
</TagsInput>
|
||||
</div>
|
||||
</Field>
|
||||
</form.Field>
|
||||
@@ -174,7 +191,12 @@ onMounted(load);
|
||||
<Field orientation="responsive">
|
||||
<FieldContent><FieldLabel :for="`curator-${index}-model`">Model</FieldLabel></FieldContent>
|
||||
<div class="flex min-w-0 flex-wrap items-center gap-3 @md/field-group:flex-1">
|
||||
<Input :id="`curator-${index}-model`" :model-value="field.state.value" placeholder="Default model" @blur="field.handleBlur" @update:model-value="field.handleChange" />
|
||||
<Select :model-value="field.state.value || ''" @update:model-value="(v) => field.handleChange(v || undefined)">
|
||||
<SelectTrigger :id="`curator-${index}-model`" class="w-64 font-mono"><SelectValue placeholder="Default model" /></SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem v-for="model in [...new Set([...modelOptions, field.state.value].filter(Boolean))]" :key="model" :value="model" class="font-mono">{{ model }}</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
</Field>
|
||||
</form.Field>
|
||||
|
||||
@@ -8,6 +8,7 @@ import { Plus, Trash2 } from "@lucide/vue";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Section } from "@/components/ui/section";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
||||
import { useSettingsStore } from "@/stores/settings";
|
||||
import DraftHint from "@/settings/DraftHint.vue";
|
||||
/**
|
||||
@@ -22,7 +23,12 @@ interface Provider {
|
||||
}
|
||||
|
||||
const store = useSettingsStore();
|
||||
onMounted(() => store.load());
|
||||
onMounted(() => {
|
||||
void store.load();
|
||||
void store.loadConfig();
|
||||
});
|
||||
// Provider classes come from the server's model catalog, not a local list.
|
||||
const classOptions = computed(() => [...new Set((store.config?.catalog ?? []).map((p) => p.class).filter(Boolean))]);
|
||||
|
||||
// Map keys are free text, so entries are read from the draft and written whole
|
||||
// through setDraftEntry; a key is never a form field path.
|
||||
@@ -96,12 +102,12 @@ const bound = computed(() => new Set(((store.draftValue("credential-bindings") a
|
||||
<Section title="Providers">
|
||||
<div v-for="[name, provider] in providerEntries" :key="name" 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 font-mono text-sm font-medium">{{ name }}</span>
|
||||
<Input
|
||||
:model-value="provider.class"
|
||||
class="w-36 font-mono"
|
||||
:aria-label="`Class for ${name}`"
|
||||
@update:model-value="(v) => setProvider(name, { class: String(v) })"
|
||||
/>
|
||||
<Select :model-value="provider.class" @update:model-value="(v) => setProvider(name, { class: String(v) })">
|
||||
<SelectTrigger class="w-36 font-mono" :aria-label="`Class for ${name}`"><SelectValue /></SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem v-for="c in [...new Set([...classOptions, provider.class].filter(Boolean))]" :key="c" :value="c" class="font-mono">{{ c }}</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<Input
|
||||
:model-value="provider.base_url ?? ''"
|
||||
class="max-w-md flex-1 font-mono max-sm:basis-full"
|
||||
|
||||
@@ -6,6 +6,7 @@ import PageHeader from "@/base/PageHeader.vue";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Field, FieldContent, FieldDescription, FieldGroup, FieldLabel } from "@/components/ui/field";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { TagsInput, TagsInputInput, TagsInputItem, TagsInputItemDelete, TagsInputItemText } from "@/components/ui/tags-input";
|
||||
import { useSettingsStore } from "@/stores/settings";
|
||||
import ApplyStatusRows from "./ApplyStatusRows.vue";
|
||||
import CardAccordion from "./CardAccordion.vue";
|
||||
@@ -40,9 +41,6 @@ function removeProfile(index: number) {
|
||||
function patch(key: string, changes: Partial<Profile>) {
|
||||
store.setDraftEntry(KIND, key, { ...profiles.value?.[key], ...changes });
|
||||
}
|
||||
function parseTools(value: string): string[] {
|
||||
return value.split(",").map(tool => tool.trim()).filter(Boolean);
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<div>
|
||||
@@ -84,7 +82,10 @@ function parseTools(value: string): string[] {
|
||||
<FieldDescription>Comma-separated tool names.</FieldDescription>
|
||||
</FieldContent>
|
||||
<div class="flex min-w-0 flex-wrap items-center gap-3 @md/field-group:flex-1">
|
||||
<Input :id="`${key}-tools`" :model-value="(profile.tools ?? []).join(', ')" @change="(e: Event) => patch(key, { tools: parseTools((e.target as HTMLInputElement).value) })" />
|
||||
<TagsInput :id="`${key}-tools`" class="flex-1" :model-value="profile.tools ?? []" :aria-label="`${key} tools`" @update:model-value="(v) => patch(key, { tools: v.map(String) })">
|
||||
<TagsInputItem v-for="tool in profile.tools ?? []" :key="tool" :value="tool"><TagsInputItemText /><TagsInputItemDelete /></TagsInputItem>
|
||||
<TagsInputInput placeholder="Add tool" />
|
||||
</TagsInput>
|
||||
</div>
|
||||
</Field>
|
||||
</FieldGroup>
|
||||
|
||||
@@ -4,8 +4,9 @@ import { Empty, EmptyHeader, EmptyTitle } from "@/components/ui/empty";
|
||||
import { computed, onMounted, ref } from "vue";
|
||||
import PageHeader from "@/base/PageHeader.vue";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Field, FieldContent, FieldDescription, FieldGroup, FieldLabel } from "@/components/ui/field";
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
||||
import { useOrgStore } from "@/stores/org";
|
||||
import { useSettingsStore } from "@/stores/settings";
|
||||
import ApplyStatusRows from "./ApplyStatusRows.vue";
|
||||
import CardAccordion from "./CardAccordion.vue";
|
||||
@@ -14,7 +15,20 @@ import SecretRefField from "./SecretRefField.vue";
|
||||
interface Binding { service: string; org?: string; secret: { engine: string; key: string } }
|
||||
const KIND = "credential-bindings";
|
||||
const store = useSettingsStore();
|
||||
onMounted(store.load);
|
||||
const orgStore = useOrgStore();
|
||||
onMounted(() => {
|
||||
void store.load();
|
||||
void orgStore.loadOrg();
|
||||
});
|
||||
|
||||
// The service vocabulary is the set of services bindings already name, as the
|
||||
// store derives it; the org vocabulary is the caller's org list. An empty org
|
||||
// means the default organisation, spelled with a sentinel because the Select
|
||||
// refuses empty item values.
|
||||
const DEFAULT_ORG = "__default__";
|
||||
function serviceOptions(current: string): string[] {
|
||||
return [...new Set([...store.credentialServices, current].filter(Boolean))];
|
||||
}
|
||||
// A root array: each edit builds a new array, since the draft is read-only.
|
||||
const bindings = computed(() => store.draftValue(KIND) as Binding[] | null);
|
||||
const open = ref("");
|
||||
@@ -44,7 +58,12 @@ function patch(index: number, changes: Partial<Binding>) {
|
||||
<Field orientation="responsive">
|
||||
<FieldContent><FieldLabel :for="`binding-${index}-service`">Service</FieldLabel></FieldContent>
|
||||
<div class="flex min-w-0 flex-wrap items-center gap-3 @md/field-group:flex-1">
|
||||
<Input :id="`binding-${index}-service`" :model-value="binding.service" @update:model-value="(v) => patch(index, { service: String(v) })" />
|
||||
<Select :model-value="binding.service" @update:model-value="(v) => patch(index, { service: String(v) })">
|
||||
<SelectTrigger :id="`binding-${index}-service`" class="w-48"><SelectValue placeholder="Service" /></SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem v-for="service in serviceOptions(binding.service)" :key="service" :value="service">{{ service }}</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
</Field>
|
||||
<Field orientation="responsive">
|
||||
@@ -53,7 +72,13 @@ function patch(index: number, changes: Partial<Binding>) {
|
||||
<FieldDescription>Empty uses the default organisation.</FieldDescription>
|
||||
</FieldContent>
|
||||
<div class="flex min-w-0 flex-wrap items-center gap-3 @md/field-group:flex-1">
|
||||
<Input :id="`binding-${index}-org`" :model-value="binding.org" @update:model-value="(v) => patch(index, { org: String(v) })" />
|
||||
<Select :model-value="binding.org || DEFAULT_ORG" @update:model-value="(v) => patch(index, { org: v === DEFAULT_ORG ? '' : String(v) })">
|
||||
<SelectTrigger :id="`binding-${index}-org`" class="w-48"><SelectValue /></SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem :value="DEFAULT_ORG">Default organisation</SelectItem>
|
||||
<SelectItem v-for="org in orgStore.orgs" :key="org.id" :value="org.id">{{ org.name || org.id }}</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
</Field>
|
||||
<Field orientation="responsive">
|
||||
|
||||
@@ -38,8 +38,8 @@ interface Provider {
|
||||
// default runs agent steps and chat when none is named; embedding and
|
||||
// transcription serve their own purposes. Others are named by steps and chat.
|
||||
const KNOWN_ALIASES = ["default", "embedding", "transcription"];
|
||||
// Provider classes the runtime SDK registers.
|
||||
const CLASSES = ["openai", "anthropic", "azure", "cohere", "deepseek", "gemini", "groq", "mistral", "ollama", "perplexity", "xai"];
|
||||
// Provider classes come from the server's model catalog (the classes the
|
||||
// runtime SDK found usable), not a local list.
|
||||
|
||||
const store = useSettingsStore();
|
||||
const orgStore = useOrgStore();
|
||||
@@ -59,6 +59,7 @@ const providerEntries = computed(() => Object.entries(providers.value ?? {}));
|
||||
const configuredIds = computed(() => providerEntries.value.map(([id]) => id));
|
||||
|
||||
const modelCatalog = computed(() => store.config?.catalog ?? []);
|
||||
const catalogClasses = computed(() => [...new Set(modelCatalog.value.map((p) => p.class).filter(Boolean))]);
|
||||
const modelOptions = computed(() => aliasModelOptions(modelCatalog.value, configuredIds.value));
|
||||
const available = computed(() => availableProviders(modelCatalog.value, configuredIds.value));
|
||||
|
||||
@@ -117,7 +118,7 @@ function addProvider() {
|
||||
if (!providers.value || !id || providers.value[id]) return;
|
||||
const found = modelCatalog.value.find((p) => p.id === id);
|
||||
store.setDraftEntry("provider-settings", id, {
|
||||
class: found?.class || (CLASSES.includes(id) ? id : "openai"),
|
||||
class: found?.class || (catalogClasses.value.includes(id) ? id : "openai"),
|
||||
api_key_env: found?.api_key_env,
|
||||
base_url: found?.base_url,
|
||||
api_key_ref: { engine: "", key: "" },
|
||||
@@ -252,7 +253,7 @@ function setAllowed(id: string, text: string) {
|
||||
<Select :model-value="provider.class" @update:model-value="(v) => setProvider(name, { class: String(v) })">
|
||||
<SelectTrigger class="w-48 font-mono" :aria-label="`Class for ${name}`"><SelectValue /></SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem v-for="c in CLASSES.includes(provider.class) ? CLASSES : [provider.class, ...CLASSES]" :key="c" :value="c">{{ c }}</SelectItem>
|
||||
<SelectItem v-for="c in catalogClasses.includes(provider.class) ? catalogClasses : [provider.class, ...catalogClasses]" :key="c" :value="c">{{ c }}</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<DraftHint kind="provider-settings" :path="`${name}.class`" />
|
||||
|
||||
Reference in new issue
Block a user