zidane-ui/ models
import { … } from 'zidane-ui/models'ui/src/models/index.ts
Components#
ModelsProviderComponent#
zidane-ui/models: the model catalog in components. ModelsProvider (which
ComposerHostProvider mounts) puts a host's catalogs in context;
useModelCatalog, useComposerModelName and useComposerProviderLabel
read them; providerColor gives each provider its color. The React-free
catalog is zidane-ui/models/headless.
function ModelsProvider(props: ModelsProviderProps): ElementParameters
| Name | Type | Description |
|---|---|---|
| props | ModelsProviderProps | The |
Returns
ElementProps
| Name | Type | Description |
|---|---|---|
| children | ReactNode | The app's components. |
| models? | ComposerModels | The host's model catalogs. Absent: no catalog, and models keep their readable ids. |
Functions#
providerColorFunction#
Text / border color.
function providerColor(providerKey: string): stringParameters
| Name | Type | Description |
|---|---|---|
| providerKey | string | The provider key, matched case-insensitively. |
Returns
stringproviderTintFunction#
Soft tinted fill for chips / badges.
function providerTint(providerKey: string, percent?: number): stringParameters
| Name | Type | Default | Description |
|---|---|---|---|
| providerKey | string | The provider key, matched case-insensitively. | |
| percent? | number | 16 | How much of the provider color to mix in, 0 to 100. |
Returns
stringuseComposerModelNameFunction#
Names a model as the model picker does; re-renders when the catalog arrives or changes.
function useComposerModelName(): ModelNamerReturns
ModelNameruseComposerProviderLabelFunction#
A provider's label as the model picker groups it (Anthropic).
function useComposerProviderLabel(): (providerKey: string) => stringReturns
(providerKey: string) => stringuseModelCatalogFunction#
The catalog to list: outer when the caller loaded one, else the host's for cwd on hostId.
function useModelCatalog(
outer: readonly ComposerModelEntry[] | null,
cwd?: string,
hostId?: string | null,
): ModelCatalogStateParameters
| Name | Type | Default | Description |
|---|---|---|---|
| outer | readonly ComposerModelEntry[] | null | A catalog the caller already holds. | |
| cwd? | string | The folder. | |
| hostId? | string | null | null | The server, |
Returns
useModelsFunction#
zidane-ui/models: the model catalog in components. ModelsProvider (which
ComposerHostProvider mounts) puts a host's catalogs in context;
useModelCatalog, useComposerModelName and useComposerProviderLabel
read them; providerColor gives each provider its color. The React-free
catalog is zidane-ui/models/headless.
function useModels(): ComposerModels | undefinedReturns
ComposerModels | undefinedInterfaces#
ModelCatalogStateInterface#
A model catalog as a picker reads it.
interface ModelCatalogStateProperties
| Name | Type | Description |
|---|---|---|
| catalog | readonly ComposerModelEntry[] | null | The rows, |
| error | string | null | Why it failed to load. |
| retry | (() => void) | undefined | Reads it again. |
ModelsProviderPropsInterface#
Props for ModelsProvider.
interface ModelsProviderPropsProperties
| Name | Type | Description |
|---|---|---|
| children | ReactNode | The app's components. |
| models? | ComposerModels | The host's model catalogs. Absent: no catalog, and models keep their readable ids. |