Documentation
¶
Overview ¶
Package picker provides reusable list picker components.
Index ¶
- func FilterTextModels(models []api.Model) []api.Model
- func FormatPricePerMillion(pricePerToken string) string
- func GetModel(item list.Item) *api.Model
- func GetSessionSummary(item list.Item) *config.SessionSummary
- func HasTextModality(modalities []string) bool
- func SetModels(m *Model, models []api.Model)
- type Config
- type Item
- type ItemDelegate
- type Model
- type ModelItem
- type SessionItem
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FilterTextModels ¶
FilterTextModels filters models to only those with text input and output.
func FormatPricePerMillion ¶
FormatPricePerMillion converts a price-per-token string to a formatted price per million tokens.
func GetSessionSummary ¶
func GetSessionSummary(item list.Item) *config.SessionSummary
GetSessionSummary extracts the SessionSummary from a selected item.
func HasTextModality ¶
HasTextModality checks if "text" is in the list of modalities.
Types ¶
type ItemDelegate ¶
type ItemDelegate struct{}
ItemDelegate renders items in the picker list.
func (ItemDelegate) Height ¶
func (d ItemDelegate) Height() int
func (ItemDelegate) Spacing ¶
func (d ItemDelegate) Spacing() int
type Model ¶
type Model struct {
List list.Model
Loading bool
Spinner spinner.Model
Err error
Width int
Height int
Quitting bool
}
Model is the Bubble Tea model for a generic picker.
func NewLoading ¶
NewLoading creates a new picker Model in loading state.
func NewModelPicker ¶
NewModelPicker creates a new picker for models in loading state.
func NewSessionPicker ¶
func NewSessionPicker(summaries []config.SessionSummary, width, height int) Model
NewSessionPicker creates a new picker for sessions.
func (Model) IsFiltering ¶
IsFiltering returns true if the picker is in filter mode.
func (Model) SelectedItem ¶
SelectedItem returns the currently selected item.
type ModelItem ¶
ModelItem wraps a Model for display in a picker.
func (ModelItem) Description ¶
func (ModelItem) FilterValue ¶
type SessionItem ¶
type SessionItem struct {
Summary config.SessionSummary
}
SessionItem wraps a SessionSummary for display in a picker.
func (SessionItem) Description ¶
func (i SessionItem) Description() string
func (SessionItem) FilterValue ¶
func (i SessionItem) FilterValue() string
func (SessionItem) Title ¶
func (i SessionItem) Title() string