Files
archie/ui/src/chat/ChatSettings.vue
T
sam 94f79177a2
deploy / gate (push) Successful in 4m53s
Quality / check (push) Successful in 6m42s
deploy / archied-image (push) Successful in 3m20s
deploy / agent-image (push) Successful in 11s
deploy / dist-zip (push) Skipped
fix(ui): adopt the type scale across components/ui and pages (#1758)
components/ui and the pages now use only the style.css scale:
text-[0.8rem]→text-label, text-[0.625rem]→text-micro, text-base/text-sm→
text-label (rows and controls), text-xs→text-caption (captions and
secondary text), text-lg/text-xl/text-2xl→text-title (panel and page
titles). Rendered markdown (ChatMarkdown/ChatInline/markdown.ts) keeps
Tailwind steps as the issue allows. 196 files, class-token swaps only.
2026-11-06 23:07:46 +11:00

59 lines
2.0 KiB
Vue

<script setup lang="ts">
import { computed } from "vue";
import {
Select,
SelectContent,
SelectGroup,
SelectItem,
SelectLabel,
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
import { selectedModel, selectorData, setModel, statusText } from "./state";
/**
* The chat's own settings: what the panel is doing right now, and the model it
* runs on. A model id already names its provider, so there is one control. It
* sits in the session menu.
*
* reka-ui refuses an empty string as an item value (that is how it spells
* "nothing selected") while the wire reads an absent value as "use the
* default", so the sentinel converts at this boundary and the state below keeps
* the empty string.
*/
const DEFAULT = "__default__";
const modelValue = computed(() => selectedModel.value || DEFAULT);
// The server groups models by provider; one flat list stands in when it does not.
const groups = computed(() => {
const grouped = selectorData.value.models_by_provider || {};
const entries = Object.entries(grouped).filter(([, models]) => models.length);
return entries.length
? entries
: [["", selectorData.value.models || []] as [string, string[]]];
});
</script>
<template>
<div class="grid gap-1 p-1">
<span v-if="statusText !== 'Ready'" class="text-caption text-fg-subtle">{{ statusText }}</span>
<Select
:model-value="modelValue"
@update:model-value="setModel($event === DEFAULT ? '' : String($event ?? ''))"
>
<SelectTrigger size="sm" class="w-full" aria-label="Model">
<SelectValue />
</SelectTrigger>
<SelectContent>
<SelectItem :value="DEFAULT">Default</SelectItem>
<SelectGroup v-for="[provider, models] in groups" :key="provider">
<SelectLabel v-if="provider">{{ provider }}</SelectLabel>
<SelectItem v-for="model in models" :key="model" :value="model">{{ model }}</SelectItem>
</SelectGroup>
</SelectContent>
</Select>
</div>
</template>