Documentation
¶
Index ¶
- type ClearCommand
- type Command
- type CommandResult
- type ExitCommand
- type ExportCommand
- func (c *ExportCommand) CanExecute(args []string) bool
- func (c *ExportCommand) Execute(ctx context.Context, args []string) (CommandResult, error)
- func (c *ExportCommand) GetDescription() string
- func (c *ExportCommand) GetName() string
- func (c *ExportCommand) GetUsage() string
- func (c *ExportCommand) PerformExport(ctx context.Context) (string, error)
- type HelpCommand
- type HistoryCommand
- type ModelsCommand
- type Registry
- func (r *Registry) Execute(ctx context.Context, name string, args []string) (CommandResult, error)
- func (r *Registry) Get(name string) (Command, bool)
- func (r *Registry) GetAll() []Command
- func (r *Registry) GetCommands() map[string]string
- func (r *Registry) GetCommandsStartingWith(prefix string) []string
- func (r *Registry) List() []string
- func (r *Registry) ParseCommand(input string) (string, []string, error)
- func (r *Registry) Register(cmd Command)
- func (r *Registry) Unregister(name string)
- type SideEffectType
- type SwitchCommand
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClearCommand ¶
type ClearCommand struct {
// contains filtered or unexported fields
}
ClearCommand clears the conversation history
func NewClearCommand ¶
func NewClearCommand(repo domain.ConversationRepository) *ClearCommand
func (*ClearCommand) CanExecute ¶
func (c *ClearCommand) CanExecute(args []string) bool
func (*ClearCommand) Execute ¶
func (c *ClearCommand) Execute(ctx context.Context, args []string) (CommandResult, error)
func (*ClearCommand) GetDescription ¶
func (c *ClearCommand) GetDescription() string
func (*ClearCommand) GetName ¶
func (c *ClearCommand) GetName() string
func (*ClearCommand) GetUsage ¶
func (c *ClearCommand) GetUsage() string
type Command ¶
type Command interface { GetName() string GetDescription() string GetUsage() string Execute(ctx context.Context, args []string) (CommandResult, error) CanExecute(args []string) bool }
Command interface represents a chat command that can be executed
type CommandResult ¶
type CommandResult struct { Output string Success bool SideEffect SideEffectType Data interface{} // Additional data for the side effect }
CommandResult represents the result of a command execution
type ExitCommand ¶
type ExitCommand struct{}
ExitCommand exits the application
func NewExitCommand ¶
func NewExitCommand() *ExitCommand
func (*ExitCommand) CanExecute ¶
func (c *ExitCommand) CanExecute(args []string) bool
func (*ExitCommand) Execute ¶
func (c *ExitCommand) Execute(ctx context.Context, args []string) (CommandResult, error)
func (*ExitCommand) GetDescription ¶
func (c *ExitCommand) GetDescription() string
func (*ExitCommand) GetName ¶
func (c *ExitCommand) GetName() string
func (*ExitCommand) GetUsage ¶
func (c *ExitCommand) GetUsage() string
type ExportCommand ¶
type ExportCommand struct {
// contains filtered or unexported fields
}
ExportCommand exports the conversation
func NewExportCommand ¶
func NewExportCommand(repo domain.ConversationRepository, chatService domain.ChatService, modelService domain.ModelService, config *config.Config) *ExportCommand
func (*ExportCommand) CanExecute ¶
func (c *ExportCommand) CanExecute(args []string) bool
func (*ExportCommand) Execute ¶
func (c *ExportCommand) Execute(ctx context.Context, args []string) (CommandResult, error)
func (*ExportCommand) GetDescription ¶
func (c *ExportCommand) GetDescription() string
func (*ExportCommand) GetName ¶
func (c *ExportCommand) GetName() string
func (*ExportCommand) GetUsage ¶
func (c *ExportCommand) GetUsage() string
func (*ExportCommand) PerformExport ¶
func (c *ExportCommand) PerformExport(ctx context.Context) (string, error)
PerformExport performs the actual export operation (called by side effect handler)
type HelpCommand ¶
type HelpCommand struct {
// contains filtered or unexported fields
}
HelpCommand shows available commands
func NewHelpCommand ¶
func NewHelpCommand(registry *Registry) *HelpCommand
func (*HelpCommand) CanExecute ¶
func (c *HelpCommand) CanExecute(args []string) bool
func (*HelpCommand) Execute ¶
func (c *HelpCommand) Execute(ctx context.Context, args []string) (CommandResult, error)
func (*HelpCommand) GetDescription ¶
func (c *HelpCommand) GetDescription() string
func (*HelpCommand) GetName ¶
func (c *HelpCommand) GetName() string
func (*HelpCommand) GetUsage ¶
func (c *HelpCommand) GetUsage() string
type HistoryCommand ¶
type HistoryCommand struct {
// contains filtered or unexported fields
}
HistoryCommand shows conversation history
func NewHistoryCommand ¶
func NewHistoryCommand(repo domain.ConversationRepository) *HistoryCommand
func (*HistoryCommand) CanExecute ¶
func (c *HistoryCommand) CanExecute(args []string) bool
func (*HistoryCommand) Execute ¶
func (c *HistoryCommand) Execute(ctx context.Context, args []string) (CommandResult, error)
func (*HistoryCommand) GetDescription ¶
func (c *HistoryCommand) GetDescription() string
func (*HistoryCommand) GetName ¶
func (c *HistoryCommand) GetName() string
func (*HistoryCommand) GetUsage ¶
func (c *HistoryCommand) GetUsage() string
type ModelsCommand ¶
type ModelsCommand struct {
// contains filtered or unexported fields
}
ModelsCommand shows available models
func NewModelsCommand ¶
func NewModelsCommand(modelService domain.ModelService) *ModelsCommand
func (*ModelsCommand) CanExecute ¶
func (c *ModelsCommand) CanExecute(args []string) bool
func (*ModelsCommand) Execute ¶
func (c *ModelsCommand) Execute(ctx context.Context, args []string) (CommandResult, error)
func (*ModelsCommand) GetDescription ¶
func (c *ModelsCommand) GetDescription() string
func (*ModelsCommand) GetName ¶
func (c *ModelsCommand) GetName() string
func (*ModelsCommand) GetUsage ¶
func (c *ModelsCommand) GetUsage() string
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry manages all available commands
func (*Registry) GetCommands ¶ added in v0.16.0
GetCommands returns a map of command names to descriptions
func (*Registry) GetCommandsStartingWith ¶
GetCommandsStartingWith returns commands that start with the given prefix
func (*Registry) ParseCommand ¶
ParseCommand parses a command line input into command name and arguments
func (*Registry) Unregister ¶
Unregister removes a command from the registry
type SideEffectType ¶
type SideEffectType int
SideEffectType defines the types of side effects a command can have
const ( SideEffectNone SideEffectType = iota SideEffectClearConversation SideEffectExportConversation SideEffectExit SideEffectSwitchModel SideEffectShowHistory SideEffectShowHelp )
type SwitchCommand ¶
type SwitchCommand struct {
// contains filtered or unexported fields
}
SwitchCommand switches the active model
func NewSwitchCommand ¶
func NewSwitchCommand(modelService domain.ModelService) *SwitchCommand
func (*SwitchCommand) CanExecute ¶
func (c *SwitchCommand) CanExecute(args []string) bool
func (*SwitchCommand) Execute ¶
func (c *SwitchCommand) Execute(ctx context.Context, args []string) (CommandResult, error)
func (*SwitchCommand) GetDescription ¶
func (c *SwitchCommand) GetDescription() string
func (*SwitchCommand) GetName ¶
func (c *SwitchCommand) GetName() string
func (*SwitchCommand) GetUsage ¶
func (c *SwitchCommand) GetUsage() string