chat

package
v0.13.5 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2025 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package chat implements the terminal-based chat interface for AI interactions. It handles the UI rendering, state management, and communication with the AI engine.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chat

type Chat struct {
	Error      *errbook.AiError // Error encountered during chat
	TokenUsage llms.Usage       // Token usage statistics from the AI
	// contains filtered or unexported fields
}

Chat represents the main chat application structure

func NewChat

func NewChat(cfg *options.Config, opts ...Option) *Chat

NewChat creates and initializes a new Chat instance cfg: Application configuration opts: Optional parameters for customizing chat behavior

func (*Chat) GetGlamOutput added in v0.13.5

func (c *Chat) GetGlamOutput() string

GetGlamOutput returns the formatted markdown output Returns the rendered markdown output string

func (*Chat) GetOutput added in v0.13.5

func (c *Chat) GetOutput() string

GetOutput returns the unescaped chat output Returns the processed chat output string

func (*Chat) Init

func (c *Chat) Init() tea.Cmd

Init initializes the chat application and returns the initial command to execute This is part of the Bubble Tea framework's initialization process

func (*Chat) Run added in v0.12.0

func (c *Chat) Run() error

Run starts the chat application and handles the main execution loop Returns error if the program fails to start or encounters an error during execution

func (*Chat) Update

func (c *Chat) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles state updates and message processing for the chat application msg: The incoming message to process Returns the updated model and commands to execute This is part of the Bubble Tea framework's update loop

func (*Chat) View

func (c *Chat) View() string

View renders the current state of the chat application Returns the string representation of the current view This is part of the Bubble Tea framework's rendering process

type Option added in v0.12.0

type Option func(*Options)

func WithContent added in v0.12.0

func WithContent(content string) Option

func WithContext added in v0.12.0

func WithContext(ctx context.Context) Option

func WithCopyToClipboard added in v0.13.5

func WithCopyToClipboard(copy bool) Option

func WithEngine added in v0.12.0

func WithEngine(engine *ai.Engine) Option

func WithMessages added in v0.12.0

func WithMessages(messages []llms.ChatMessage) Option

func WithPromptMode added in v0.12.0

func WithPromptMode(promptMode ui.PromptMode) Option

func WithRenderer added in v0.12.0

func WithRenderer(renderer *lipgloss.Renderer) Option

func WithRunMode added in v0.12.0

func WithRunMode(runMode ui.RunMode) Option

func WithWordWrap added in v0.12.0

func WithWordWrap(wordWrap int) Option

type Options added in v0.12.0

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

func NewOptions added in v0.12.0

func NewOptions(opts ...Option) *Options

Jump to

Keyboard shortcuts

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