Documentation ¶
Index ¶
- func DisplayWelcome(config WelcomeConfig)
- func EventLoop(ctx context.Context, cancel context.CancelFunc, inputCh chan string, ...)
- func GenerateCompletion(ctx context.Context, conversation chat.Conversation, renderer *term.Renderer, ...) (string, error)
- func HandleCommands(text string, conversation chat.Conversation) string
- func InitChatDatabase(sqlitePath string) (chat.Repository, error)
- func InitCodeDatabase(sqlitePath string) (code.Repository, error)
- func InitConversation(repo chat.Repository, conversationID *string, defaultPrompt prompts.Prompt) (chat.Conversation, error)
- func InitJSONProviders(logger *logger.Logger, targetModel string) (baseprovider.TextToJSONProvider, error)
- func InitTextProviders(logger *logger.Logger, targetModel string, reasoning bool) (baseprovider.TextToTextProvider, error)
- func InitTranscriptionServer(oaiKey string, audioOpts *audio.StreamParameters, log *logger.Logger, ...) (*transcription.TranscriptionServer, error)
- func InitVoice(cfg *config.Config, log *logger.Logger, ...) (*audio.StreamHandler, <-chan struct{}, <-chan struct{}, error)
- func SetupKeyHooks(cmdKeyCode uint16, ts *transcription.TranscriptionServer) (chan struct{}, chan struct{})
- type Conversation
- type ModelProvider
- type ProcessInputFuncT
- type WelcomeConfig
- type WelcomeOption
- func WithAdditionalLine(line string) WelcomeOption
- func WithBuildDate(date string) WelcomeOption
- func WithBuildVersion(version string) WelcomeOption
- func WithInstruction(instr string) WelcomeOption
- func WithModelProvider(mp ModelProvider) WelcomeOption
- func WithProvider(provider providers.AIProvider) WelcomeOption
- func WithStartPrompt(prompt string) WelcomeOption
- func WithWelcomeMessage(msg string) WelcomeOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DisplayWelcome ¶
func DisplayWelcome(config WelcomeConfig)
func EventLoop ¶
func EventLoop( ctx context.Context, cancel context.CancelFunc, inputCh chan string, inputErrCh chan error, readyCh chan struct{}, voiceInputCh chan string, audioStartCh, audioEndCh <-chan struct{}, inputStream *audio.StreamHandler, log *logger.Logger, conversation chat.Conversation, renderer *term.Renderer, textToTextBackend baseprovider.TextToTextProvider, processInputFunc ProcessInputFuncT, )
EventLoop manages the main event loop.
func GenerateCompletion ¶
func GenerateCompletion( ctx context.Context, conversation chat.Conversation, renderer *term.Renderer, textToTextBackend baseprovider.TextToTextProvider, ) (string, error)
GenerateCompletion generates a completion using the provided backend.
func HandleCommands ¶
func HandleCommands(text string, conversation chat.Conversation) string
func InitChatDatabase ¶
func InitChatDatabase(sqlitePath string) (chat.Repository, error)
InitChatDatabase initializes the chat repository.
func InitCodeDatabase ¶
func InitCodeDatabase(sqlitePath string) (code.Repository, error)
InitCodeDatabase initializes the code repository.
func InitConversation ¶
func InitConversation( repo chat.Repository, conversationID *string, defaultPrompt prompts.Prompt, ) (chat.Conversation, error)
InitConversation initializes the conversation. If conversationID is nil, a new conversation is created.
func InitJSONProviders ¶ added in v0.2.0
func InitJSONProviders( logger *logger.Logger, targetModel string, ) (baseprovider.TextToJSONProvider, error)
InitJSONProviders initializes the text-to-json provider.
func InitTextProviders ¶ added in v0.2.0
func InitTextProviders( logger *logger.Logger, targetModel string, reasoning bool, ) (baseprovider.TextToTextProvider, error)
InitTextProviders initializes the text-to-text provider.
func InitTranscriptionServer ¶
func InitTranscriptionServer( oaiKey string, audioOpts *audio.StreamParameters, log *logger.Logger, callback transcription.TranscriptionServerCallbackT, language string, ) (*transcription.TranscriptionServer, error)
InitTranscriptionServer initializes the Transcription Server with predefined buffer settings.
func SetupKeyHooks ¶
func SetupKeyHooks( cmdKeyCode uint16, ts *transcription.TranscriptionServer, ) (chan struct{}, chan struct{})
SetupKeyHooks sets up global key hooks for audio control.
Types ¶
type Conversation ¶
type Conversation interface {
GetID() string
}
type ModelProvider ¶
type ModelProvider interface {
GetModel() string
}
type ProcessInputFuncT ¶
type ProcessInputFuncT func(context.Context, string, chat.Conversation, *glamour.TermRenderer, baseprovider.TextToTextProvider)
TODO(nullswan): Refactor this to use a more generic function signature.
type WelcomeConfig ¶
type WelcomeConfig struct { Conversation Conversation Provider []providers.AIProvider ModelProviders []ModelProvider WelcomeMessage string StartPrompt *string BuildVersion string BuildDate string AdditionalLines []string Instructions []string }
func NewWelcomeConfig ¶
func NewWelcomeConfig( conversation Conversation, opts ...WelcomeOption, ) WelcomeConfig
type WelcomeOption ¶
type WelcomeOption func(*WelcomeConfig)
func WithAdditionalLine ¶
func WithAdditionalLine(line string) WelcomeOption
func WithBuildDate ¶
func WithBuildDate(date string) WelcomeOption
func WithBuildVersion ¶
func WithBuildVersion(version string) WelcomeOption
func WithInstruction ¶
func WithInstruction(instr string) WelcomeOption
func WithModelProvider ¶
func WithModelProvider(mp ModelProvider) WelcomeOption
func WithProvider ¶
func WithProvider(provider providers.AIProvider) WelcomeOption
func WithStartPrompt ¶
func WithStartPrompt(prompt string) WelcomeOption
func WithWelcomeMessage ¶
func WithWelcomeMessage(msg string) WelcomeOption