tools

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	Command string
	Args    []string
	Input   string
}

func NewCommand

func NewCommand(command string, args ...string) *Command

func (*Command) String

func (c *Command) String() string

func (*Command) WithArgs

func (c *Command) WithArgs(args ...string) *Command

func (*Command) WithInput

func (c *Command) WithInput(input string) *Command

type Console

type Console interface {
	Exec(context.Context, *Command) (ExecResult, error)
}

func NewBashConsole

func NewBashConsole() Console

type ExecResult

type ExecResult struct {
	ExitCode int
	Output   string
	Error    string
}

func (ExecResult) Success

func (e ExecResult) Success() bool

type InputHandler

type InputHandler interface {
	Read(ctx context.Context, defaultValue string) (string, error)

	WithVoiceInput(
		voiceInputCh chan string,
		audioStartCh <-chan struct{},
		audioEndCh <-chan struct{},
		inputStream *audio.AudioStream,
	)
}

func NewInputHandler

func NewInputHandler(
	logger *slog.Logger,
	readyCh chan struct{},
	inputCh chan string,
	inputErrCh chan error,
) InputHandler

type Logger

type Logger interface {
	Debug(msg string)
	Info(msg string)
	Error(msg string)
	Println(msg string)
}

func NewLogger

func NewLogger(
	devMode bool,
) Logger

type Selector

type Selector interface {
	SelectBool(title string, defaultValue bool) bool
	SelectString(title string, items []string) string
}

func NewSelector

func NewSelector() Selector

type TextToJSONBackend

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

func NewTextToJSONBackend

func NewTextToJSONBackend(
	backend baseprovider.TextToJSONProvider,
	logger *slog.Logger,
) TextToJSONBackend

func (TextToJSONBackend) Do

func (t TextToJSONBackend) Do(
	ctx context.Context,
	conversation chat.Conversation,
) (string, error)

type TextToTextBackend

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

func NewTextToTextBackend

func NewTextToTextBackend(
	backend baseprovider.TextToTextProvider,
	logger *slog.Logger,
) TextToTextBackend

func (TextToTextBackend) Do

func (t TextToTextBackend) Do(
	ctx context.Context,
	conversation chat.Conversation,
) (string, error)

type VoiceInput

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

func NewVoiceInput

func NewVoiceInput(
	cfg *config.Config,
	logger *slog.Logger,
	voiceInputCh chan string,
) (*VoiceInput, error)

func (*VoiceInput) Close

func (v *VoiceInput) Close()

func (*VoiceInput) GetAudioEndCh

func (v *VoiceInput) GetAudioEndCh() <-chan struct{}

func (*VoiceInput) GetAudioStartCh

func (v *VoiceInput) GetAudioStartCh() <-chan struct{}

func (*VoiceInput) GetInputStream

func (v *VoiceInput) GetInputStream() *audio.AudioStream

Jump to

Keyboard shortcuts

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