chat

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

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
	Output     string
	GlamOutput string
	// contains filtered or unexported fields
}

func NewChat

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

func (*Chat) Init

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

func (*Chat) Run added in v0.12.0

func (c *Chat) Run() error

Run starts the chat.

func (*Chat) Update

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

func (*Chat) View

func (c *Chat) View() string

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 WithEngine added in v0.12.0

func WithEngine(engine *llm.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

type Prompt

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

func NewPrompt

func NewPrompt(mode ui.PromptMode) *Prompt

func (*Prompt) AsString

func (p *Prompt) AsString() string

func (*Prompt) Blur

func (p *Prompt) Blur() *Prompt

func (*Prompt) Focus

func (p *Prompt) Focus() *Prompt

func (*Prompt) GetMode

func (p *Prompt) GetMode() ui.PromptMode

func (*Prompt) GetValue

func (p *Prompt) GetValue() string

func (*Prompt) SetMode

func (p *Prompt) SetMode(mode ui.PromptMode) *Prompt

func (*Prompt) SetValue

func (p *Prompt) SetValue(value string) *Prompt

func (*Prompt) Update

func (p *Prompt) Update(msg tea.Msg) (*Prompt, tea.Cmd)

func (*Prompt) View

func (p *Prompt) View() string

type Renderer

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

func NewRenderer

func NewRenderer(options ...glamour.TermRendererOption) *Renderer

func (*Renderer) RenderApiBaseConfigMessage

func (r *Renderer) RenderApiBaseConfigMessage() string

func (*Renderer) RenderApiTokenConfigMessage

func (r *Renderer) RenderApiTokenConfigMessage() string

func (*Renderer) RenderConfigMessage

func (r *Renderer) RenderConfigMessage(username string) string

func (*Renderer) RenderContent

func (r *Renderer) RenderContent(in string) string

func (*Renderer) RenderError

func (r *Renderer) RenderError(in string) string

func (*Renderer) RenderHelp

func (r *Renderer) RenderHelp(in string) string

func (*Renderer) RenderHelpMessage

func (r *Renderer) RenderHelpMessage() string

func (*Renderer) RenderSuccess

func (r *Renderer) RenderSuccess(in string) string

func (*Renderer) RenderWarning

func (r *Renderer) RenderWarning(in string) string

Jump to

Keyboard shortcuts

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