Documentation
¶
Index ¶
- type GenModelInputResult
- type HookManager
- func (hm *HookManager) ExecuteHook(ctx context.Context, cfg *config.SessionHookConfig, sessionID string, ...) ([]byte, error)
- func (hm *HookManager) OnGenModelInput(ctx context.Context, sessionID string, sessionName string, ...) ([]*schema.Message, error)
- func (hm *HookManager) OnSessionKeep(ctx context.Context, sessionID string, sessionName string, ...) error
- type SessionHookData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GenModelInputResult ¶
GenModelInputResult represents the result returned by genmodelinput hook
type HookManager ¶
type HookManager struct {
// contains filtered or unexported fields
}
HookManager manages session hooks
func NewHookManager ¶
func NewHookManager(hooksConfig *config.SessionHooks) *HookManager
func (*HookManager) ExecuteHook ¶ added in v1.8.0
func (hm *HookManager) ExecuteHook(ctx context.Context, cfg *config.SessionHookConfig, sessionID string, sessionName string, messages []*schema.Message, logPrefix string) ([]byte, error)
ExecuteHook runs the given hook configuration (script or http) and returns its raw output. It is shared by the session hooks and the cron tasks (whose hook output must be JSON).
func (*HookManager) OnGenModelInput ¶
func (hm *HookManager) OnGenModelInput(ctx context.Context, sessionID string, sessionName string, messages []*schema.Message) ([]*schema.Message, error)
OnGenModelInput executes the genmodelinput hook if enabled It passes session data via stdin and expects JSON output with []message
func (*HookManager) OnSessionKeep ¶
func (hm *HookManager) OnSessionKeep(ctx context.Context, sessionID string, sessionName string, messages []*schema.Message) error
OnSessionClear executes the session clear hook if enabled