tui

package module
v0.0.0-...-33cd15d Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2025 License: Apache-2.0 Imports: 26 Imported by: 3

Documentation

Index

Constants

View Source
const (
	Yes    = Answer("Yes")
	No     = Answer("No")
	Always = Answer("Always")
)
View Source
const ToolCallHeader = "<tool call>"

Variables

View Source
var (
	MarkdownRender *glamour.TermRenderer
	BoxStyle       = lipgloss.NewStyle().
					BorderStyle(lipgloss.NormalBorder()).
					PaddingLeft(1).
					PaddingRight(1).
					MarginLeft(4).
					MarginBottom(1).
					MaxWidth(pterm.GetTerminalWidth() - 4)
)

Functions

func Run

func Run(ctx context.Context, tool string, opts ...RunOptions) error

Types

type Answer

type Answer string

type Confirm

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

func NewConfirm

func NewConfirm(appName string, client *gptscript.GPTScript, trustedRepoPrefixes ...string) (*Confirm, error)

func (*Confirm) HandleConfirm

func (c *Confirm) HandleConfirm(ctx context.Context, event gptscript.Frame, prompter func(string) (Answer, bool, error)) (bool, error)

func (*Confirm) HandlePrompt

func (c *Confirm) HandlePrompt(ctx context.Context, event gptscript.Frame, prompter func(string, bool, bool) (string, bool)) (bool, error)

func (*Confirm) IsConfirmEvent

func (c *Confirm) IsConfirmEvent(event gptscript.Frame) bool

func (*Confirm) IsPromptEvent

func (c *Confirm) IsPromptEvent(event gptscript.Frame) bool

func (*Confirm) IsTrusted

func (c *Confirm) IsTrusted(event gptscript.Frame) (ConfirmPrompt, bool, error)

func (*Confirm) SetTrusted

func (c *Confirm) SetTrusted(prompt ConfirmPrompt, answer Answer)

type ConfirmPrompt

type ConfirmPrompt struct {
	Repo        string
	Message     string
	AlwaysTrust Trusted
}

type RunOptions

type RunOptions struct {
	AppName               string
	Eval                  []gptscript.ToolDef
	TrustedRepoPrefixes   []string
	DisableCache          bool
	CredentialOverrides   []string
	Input                 string
	SubTool               string
	ChatState             string
	SaveChatStateFile     string
	Workspace             string
	UserStartConversation *bool
	Location              string
	EventLog              string
	LoadMessage           string
	ForceSequential       bool
	Client                *gptscript.GPTScript
	ClientOpts            *gptscript.GlobalOptions
	// contains filtered or unexported fields
}

type Trusted

type Trusted struct {
	ToolName  string
	ArgPrefix map[string]string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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