Documentation
¶
Overview ¶
Package command implements shared slash-command handling for chat UIs.
The Handler processes commands like /model, /session, /reset, /help etc. and works with any ui.Context so the same logic can be used by terminal, Telegram, and other frontends.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface {
GetSession(ctx context.Context, id string) (*schema.Session, error)
CreateSession(ctx context.Context, meta schema.SessionMeta) (*schema.Session, error)
UpdateSession(ctx context.Context, id string, meta schema.SessionMeta) (*schema.Session, error)
DeleteSession(ctx context.Context, id string) error
ListSessions(ctx context.Context, opts ...opt.Opt) (*schema.ListSessionResponse, error)
ListModels(ctx context.Context, opts ...opt.Opt) (*schema.ListModelsResponse, error)
ListTools(ctx context.Context, opts ...opt.Opt) (*schema.ListToolResponse, error)
}
Client is the minimal API surface needed by the command handler. *httpclient.Client satisfies this interface.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler processes slash commands against the API.
type Hooks ¶
type Hooks interface {
// OnSessionChanged is called when the active session changes
// (via /session <id> or /reset). The frontend can persist the
// new session ID or update its display.
OnSessionChanged(sessionID string)
// OnSessionReset is called after /reset creates a new session.
// The frontend can clear its message history.
OnSessionReset()
// ResetMeta returns extra session metadata to include when /reset
// creates a new session (e.g. labels, name). Return nil for defaults.
ResetMeta() *schema.SessionMeta
}
Hooks allows frontends to inject UI-specific behaviour into certain commands. All methods are optional - nil Hooks is safe.
Click to show internal directories.
Click to hide internal directories.