Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetOpenAIErrCode ¶
Types ¶
type Bot ¶
type Bot struct {
// contains filtered or unexported fields
}
func (*Bot) ClearExpiredSessionsPeriodically ¶
func (bot *Bot) ClearExpiredSessionsPeriodically()
type ChangeRoleTask ¶
type ChangeRoleTask struct { Session *Session Role string ReplyFn func(reply string, imgUrls ...string) error }
func (*ChangeRoleTask) Do ¶
func (task *ChangeRoleTask) Do(bot *Bot) error
type ChatTask ¶
type ClearSessionTask ¶
type ClearSessionTask struct { Session *Session ReplyFn func(reply string, imgUrls ...string) error }
func (*ClearSessionTask) Do ¶
func (task *ClearSessionTask) Do(bot *Bot) error
type Session ¶
type Session struct { ID string Role string Messages []openai.ChatCompletionMessage LastUpdateDate time.Time }
func NewSession ¶
func (*Session) AddMessage ¶
func (s *Session) AddMessage(msg *openai.ChatCompletionMessage)
func (*Session) ChangeRole ¶
type SessionManager ¶
func NewSessionManager ¶
func NewSessionManager() *SessionManager
func (*SessionManager) ClearExpiredSessions ¶
func (m *SessionManager) ClearExpiredSessions(expiryPeriod time.Duration) []string
func (*SessionManager) GetSession ¶
func (m *SessionManager) GetSession(id string, defaultRole string) *Session
Click to show internal directories.
Click to hide internal directories.