Model Picker

Pick the model that answers: grouped, searchable, with what each is good at, its context size and a cost hint.

New chats start with Quill 4.

Installation

pnpm dlx shadcn@latest add checkfu/uicontext/model-picker

Usage

import { ModelPicker } from "./ui/uicontext/components/chat/ModelPicker.ts"import type { ChatModel } from "./ui/uicontext/components/domain/Chat.ts"
const Message = UiSchema.TaggedEnum({ PickedModel: { model: Schema.String }, SavedDefaultModel: { model: Schema.String } })// the chat owns its model; the account owns the default for new chatsexport const ChatModelPicker = (h: Html.H<typeof Message.Type>, models: ReadonlyArray<ChatModel>, chat: string, fallback: string) =>	ModelPicker(h, {		props: { models, value: chat, defaultModel: fallback },		onEmit: {			Picked: ({ model }) => Message.PickedModel({ model }),			RequestedDefault: ({ model }) => Message.SavedDefaultModel({ model }),		},	})

Examples

In the composer

The composer's tools slot holds the picker beside the attach button; the list opens upward from the bottom of the screen.

API reference

Props

ModelPicker props
NameTypeDefaultDescription
modelsrequiredChatModel[]——
valuerequiredstring—The conversation's model
defaultModelstring—The model new chats start with; marked in the list
labelstring"Model"What it picks, for screen readers and agents: "Model" by default
agentIdstring—This picker's id for agents, unique on the page
disabledboolean——
align"start" | "end""start"Which edge of the button the list lines up with: "start" by default
side"top" | "bottom"—Open upward, as from a composer at the bottom of the screen

Events

ModelPicker events
EventPayloadDescription
Picked{ model: string }The person picked a model for this conversation
RequestedDefault{ model: string }Make model the one new chats start with

Agent actions

What agents can do with ModelPicker
ActionDescription
PickedModelAnswer with another model, by its id (see the choices)

Source