gizapp/chatui
Presentation values for chat components. No records, persistence or agent runtime.
import * as Chatui from "gizapp/chatui";Types
ModelOption
type ModelOption = { id: string; name: string; group: string; note: string; price?: f64; context?: i64; created?: i64; vendor?: string; category?: string; line?: string; about?: string; href?: string; }A model a list shows (ModelList): its id, name, group (a heading: where it runs, or what it makes) and a short note
(whether it is installed, its price); its maker (vendor, whose mark leads the row), a line under its name (line:
what it takes and makes; its maker when not given), a line about it (about, its row's title) and href when its row
is a link (else it is a choice); for sorting, its dollars per million input and output tokens or per use (price),
its context window in tokens (context) and when it was published (created, Unix seconds), and for its filter how a
plan pays for it (category: "included", "usage"), each left out when not known.
id:stringname:stringgroup:stringnote:stringprice:_gizlang_sdk_core.Option<f64>context:_gizlang_sdk_core.Option<i64>created:_gizlang_sdk_core.Option<i64>vendor:_gizlang_sdk_core.Option<string>category:_gizlang_sdk_core.Option<string>line:_gizlang_sdk_core.Option<string>about:_gizlang_sdk_core.Option<string>href:_gizlang_sdk_core.Option<string>
Sortable
type Sortable = { name: string; vendor: string; price: f64; context: i64; created: i64; }What a row sorts by: its name, its maker ("" not said), its price in dollars (-1 not said), its context window in tokens and when it was published (0 not said).
name:stringvendor:stringprice:f64context:i64created:i64
Source
type Source = { title: string; url: string; }A source a reply cites: its title and URL.
title:stringurl:string
Chip
type Chip = { letter: string; site: string; title: string; url: string; }A cited site as a chip: its initial, site, title and URL.
letter:stringsite:stringtitle:stringurl:string
ContextPart
type ContextPart = { name: string; tokens: i64; }A part of a model's context: its name and its tokens (gizai/agent's Share).
name:stringtokens:i64
Functions
sortsOf
function sortsOf(rows: Vec<Sortable>): Vec<string>The sorts of ROWS: "" (as listed) and each that some row says what it orders by.
Effects: fail, alloc.
places
function places(rows: Vec<Sortable>): Vec<Vec<i64>>Each row's place (from 1) under every sort of SORT_KEYS: places[k][n] is row N's under SORT_KEYS[k].
Effects: fail, alloc.
placeOf
function placeOf(places: Vec<Vec<i64>>, n: i64, key: string): i64Row N's place under the sort KEY (a row's --o-KEY); 0 for none (N < 0, or no places: the row stays first).
Effects: fail, alloc.
sortable
function sortable(m: ModelOption): SortableA model option as a row to sort.
inCategory
function inCategory(models: Vec<ModelOption>, category: string): i64How many of MODELS a plan pays for as CATEGORY says ("included", "usage").
Effects: fail, alloc.
chips
function chips(sources: Vec<Source>): Vec<Chip>One chip per distinct site of sources, at most six.
Effects: fail, alloc.
keyed
function keyed(text: string, key: string): stringThe HTML of Markdown text, its blocks keyed by key.
Effects: fail, read, write, console, io, alloc.
groups
function groups(models: Vec<ModelOption>): Vec<string>The distinct groups of models, in order.
Effects: fail, alloc.
contextParts
function contextParts(json: string): Vec<ContextPart>The parts in json (a JSON list of ContextPart, as a host keeps them); none when it is empty or not such a list.
Effects: fail, alloc.
Constants
SORT_KEYS
const SORT_KEYS = ["new", "cheap", "dear", "context", "name", "vendor"]The sorts that reorder, in the order of the menu (after "", as listed).