tools

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AudioStream added in v0.3.2

type AudioStream interface {
	Start() error
	Close() error
}

func NewAudioStream added in v0.3.2

func NewAudioStream(
	logger *slog.Logger,
	device *portaudio.DeviceInfo,
	callback func([]float32),
) (AudioStream, error)

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 FileKnowledgeBase added in v0.3.2

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

func NewFileKnowledgeBase added in v0.3.2

func NewFileKnowledgeBase(repositoryPath string) *FileKnowledgeBase

func (*FileKnowledgeBase) Close added in v0.3.2

func (f *FileKnowledgeBase) Close() error

func (*FileKnowledgeBase) QueryAll added in v0.3.2

func (f *FileKnowledgeBase) QueryAll() (string, error)

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.StreamHandler,
	)
}

TODO(nullswan): Handle Command handling

func NewInputHandler

func NewInputHandler(
	logger *slog.Logger,
) InputHandler

type KnowledgeBase added in v0.3.2

type KnowledgeBase interface {
	QueryAll() (string, error)
	Close() error
}

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 TextToSpeechBackend added in v0.2.3

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

func NewTextToSpeechBackend added in v0.2.3

func NewTextToSpeechBackend(
	backend baseprovider.TextToSpeechProvider,
	logger *slog.Logger,
) *TextToSpeechBackend

func (TextToSpeechBackend) Do added in v0.2.3

func (t TextToSpeechBackend) Do(
	ctx context.Context,
	message string,
) ([]byte, error)

func (TextToSpeechBackend) Speak added in v0.2.3

func (t TextToSpeechBackend) Speak(
	ctx context.Context,
	message 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.StreamHandler

Jump to

Keyboard shortcuts

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