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.
59 lines
2.0 KiB
Vue
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>
|