terminal

package
v0.0.0-...-1090884 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 4, 2025 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckTerminalCapabilities

func CheckTerminalCapabilities() error

CheckTerminalCapabilities ensures the terminal supports required features

func CurrentModel

func CurrentModel() string

CurrentModel returns the currently selected model (or empty string if unknown).

func GetAvailableModels

func GetAvailableModels() []string

GetAvailableModels returns the list of available AI models from config.yaml

func GetAvailableModelsByProvider

func GetAvailableModelsByProvider() map[string][]string

GetAvailableModelsByProvider returns models grouped by provider

func GetModelDisplayName

func GetModelDisplayName(modelName string) string

GetModelDisplayName returns the full model name for display

func GetToolsEnabled

func GetToolsEnabled() bool

GetToolsEnabled returns whether tools are currently enabled

func GetToolsOutputEnabled

func GetToolsOutputEnabled() bool

GetToolsOutputEnabled returns whether tool output should be shown in the UI

func GetVersion

func GetVersion() string

GetVersion returns the version from config.yaml

func GetVersionDisplay

func GetVersionDisplay() string

GetVersionDisplay returns the formatted version string for display

func SetCurrentModel

func SetCurrentModel(name string)

SetCurrentModel stores the model name selected by the user/UI.

func SetSpeechModeEnabled

func SetSpeechModeEnabled(enabled bool)

SetSpeechModeEnabled sets global speech mode flag

func SpeechModeEnabled

func SpeechModeEnabled() bool

SpeechModeEnabled returns whether speech mode is globally enabled

func StartUI

func StartUI() error

StartUI initializes and runs the Bubble Tea program

func StartUIWithoutAltScreen

func StartUIWithoutAltScreen() error

StartUIWithoutAltScreen runs the UI without alternative screen mode Useful for development or when you want to preserve terminal history

func ToggleTools

func ToggleTools()

ToggleTools toggles the tools enabled/disabled state in the global config

Types

type Config

type Config struct {
	Name    string `yaml:"name"`
	Version string `yaml:"version"`
}

Config represents the structure of config.yaml

type ConfigYAML

type ConfigYAML struct {
	Providers map[string]struct {
		Models []string `yaml:"models"`
	} `yaml:"providers"`
}

ConfigYAML represents the structure of config.yaml for model loading

type ConversationPair

type ConversationPair struct {
	UserMessage  string
	AIResponse   string
	IsProcessing bool // Whether this conversation is currently being processed
}

ConversationPair represents a user message and AI response pair

type HelpModel

type HelpModel struct {
	// contains filtered or unexported fields
}

HelpModel represents the full-screen help interface

func NewHelpModel

func NewHelpModel() HelpModel

NewHelpModel creates a new help model

func (HelpModel) Init

func (m HelpModel) Init() tea.Cmd

Init initializes the help model

func (HelpModel) Update

func (m HelpModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles messages for the help model

func (HelpModel) View

func (m HelpModel) View() string

View renders the help screen

type HistoryManager

type HistoryManager struct {
	// contains filtered or unexported fields
}

HistoryManager handles persistent storage of input history

func NewHistoryManager

func NewHistoryManager() (*HistoryManager, error)

NewHistoryManager creates a new history manager

func (*HistoryManager) AddMessage

func (hm *HistoryManager) AddMessage(message string) error

AddMessage adds a message to history (avoiding duplicates and empty messages)

func (*HistoryManager) ClearHistory

func (hm *HistoryManager) ClearHistory() error

ClearHistory clears all history

func (*HistoryManager) GetHistory

func (hm *HistoryManager) GetHistory() []string

GetHistory returns the full history slice

func (*HistoryManager) GetHistoryCount

func (hm *HistoryManager) GetHistoryCount() int

GetHistoryCount returns the number of items in history

func (*HistoryManager) GetHistoryFile

func (hm *HistoryManager) GetHistoryFile() string

GetHistoryFile returns the path to the history file

func (*HistoryManager) GetMessageAt

func (hm *HistoryManager) GetMessageAt(index int) string

GetMessageAt returns the message at the given index (0 = oldest, len-1 = newest)

func (*HistoryManager) LoadFromFile

func (hm *HistoryManager) LoadFromFile() error

LoadFromFile loads history from disk

func (*HistoryManager) SaveToFile

func (hm *HistoryManager) SaveToFile() error

SaveToFile saves the current history to disk

type InputModel

type InputModel struct {
	// contains filtered or unexported fields
}

InputModel represents the text input state

func NewInputModel

func NewInputModel(provider string) InputModel

NewInputModel creates a new input model for the selected provider

func (*InputModel) AddConversationPair

func (m *InputModel) AddConversationPair(userMsg, aiResponse string)

AddConversationPair adds a user message and AI response pair to the conversation

func (InputModel) Init

func (m InputModel) Init() tea.Cmd

func (*InputModel) SetAIResponse

func (m *InputModel) SetAIResponse(aiResponse string)

SetAIResponse sets the AI response for the most recent conversation pair

func (InputModel) ShouldTriggerHelp

func (m InputModel) ShouldTriggerHelp() bool

ShouldTriggerHelp returns true if help screen should be triggered

func (InputModel) ShouldTriggerModelSelect

func (m InputModel) ShouldTriggerModelSelect() bool

ShouldTriggerModelSelect returns true if model selection screen should be triggered

func (InputModel) Update

func (m InputModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (InputModel) View

func (m InputModel) View() string
type MenuModel struct {
	// contains filtered or unexported fields
}

MenuModel represents the main menu state

func NewMenuModel

func NewMenuModel() MenuModel

Initialize the menu model

func (m MenuModel) Init() tea.Cmd

Init is the first function that will be called when the program starts

func (m MenuModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles incoming messages and updates the model state

func (m MenuModel) View() string

View renders the UI

type ModelSelectModel

type ModelSelectModel struct {
	// contains filtered or unexported fields
}

ModelSelectModel represents the full-screen model selection interface

func NewModelSelectModel

func NewModelSelectModel() ModelSelectModel

NewModelSelectModel creates a new model selection model

func (ModelSelectModel) GetSelectedModel

func (m ModelSelectModel) GetSelectedModel() string

GetSelectedModel returns the selected model name

func (ModelSelectModel) Init

func (m ModelSelectModel) Init() tea.Cmd

Init initializes the model selection model

func (ModelSelectModel) Update

func (m ModelSelectModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles messages for the model selection model

func (ModelSelectModel) View

func (m ModelSelectModel) View() string

View renders the model selection screen

type SlashCommand

type SlashCommand struct {
	Name        string
	Description string
}

SlashCommand represents a slash command with its name and description

func FilterCommands

func FilterCommands(input string) []SlashCommand

FilterCommands filters slash commands based on the input text

func GetAvailableCommands

func GetAvailableCommands() []SlashCommand

GetAvailableCommands returns the list of available slash commands in alphabetical order

type TreeItem

type TreeItem struct {
	Text       string // Display text
	Value      string // Actual value (model name or empty for providers)
	IsProvider bool   // True if this is a provider header
	IsLast     bool   // True if this is the last model in a provider group
}

TreeItem represents an item in the tree structure

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL