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()
func (*Bot) UpdateApiServerAccessToken ¶
type ChangeRoleTask ¶
type ChangeRoleTask struct { SessionID string Role string ReplyFn func(reply string, imgUrls ...string) error }
func (*ChangeRoleTask) Do ¶
func (task *ChangeRoleTask) Do(bot *Bot) error
type ChatTask ¶
type ClearExpiredSessionsTask ¶
func (*ClearExpiredSessionsTask) Do ¶
func (task *ClearExpiredSessionsTask) Do(bot *Bot) error
type ClearSessionTask ¶
type ClearSessionTask struct { SessionID string 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(defaultRole string) *SessionManager
func (*SessionManager) ClearExpiredSessions ¶
func (m *SessionManager) ClearExpiredSessions(expiryPeriod time.Duration) []string
func (*SessionManager) GetSession ¶
func (m *SessionManager) GetSession(id string) *Session
Click to show internal directories.
Click to hide internal directories.