Documentation
¶
Index ¶
- type Session
- type SessionManager
- func (sm *SessionManager) AddMessage(sessionKey, role, content string)
- func (sm *SessionManager) AddMessageFull(sessionKey string, msg providers.Message)
- func (sm *SessionManager) CompactSession(key string, keepLast int, note string) bool
- func (sm *SessionManager) Count() int
- func (sm *SessionManager) GetHistory(key string) []providers.Message
- func (sm *SessionManager) GetLanguagePreferences(key string) (preferred string, last string)
- func (sm *SessionManager) GetOrCreate(key string) *Session
- func (sm *SessionManager) GetSummary(key string) string
- func (sm *SessionManager) Keys() []string
- func (sm *SessionManager) List(limit int) []Session
- func (sm *SessionManager) Save(session *Session) error
- func (sm *SessionManager) SetLastLanguage(key, lang string)
- func (sm *SessionManager) SetPreferredLanguage(key, lang string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Session ¶
type Session struct {
Key string `json:"key"`
SessionID string `json:"session_id,omitempty"`
Kind string `json:"kind,omitempty"`
Messages []providers.Message `json:"messages"`
Summary string `json:"summary,omitempty"`
CompactionCount int `json:"compaction_count,omitempty"`
LastLanguage string `json:"last_language,omitempty"`
PreferredLanguage string `json:"preferred_language,omitempty"`
Created time.Time `json:"created"`
Updated time.Time `json:"updated"`
// contains filtered or unexported fields
}
type SessionManager ¶
type SessionManager struct {
// contains filtered or unexported fields
}
func NewSessionManager ¶
func NewSessionManager(storage string) *SessionManager
func (*SessionManager) AddMessage ¶
func (sm *SessionManager) AddMessage(sessionKey, role, content string)
func (*SessionManager) AddMessageFull ¶
func (sm *SessionManager) AddMessageFull(sessionKey string, msg providers.Message)
func (*SessionManager) CompactSession ¶
func (sm *SessionManager) CompactSession(key string, keepLast int, note string) bool
func (*SessionManager) Count ¶
func (sm *SessionManager) Count() int
func (*SessionManager) GetHistory ¶
func (sm *SessionManager) GetHistory(key string) []providers.Message
func (*SessionManager) GetLanguagePreferences ¶
func (sm *SessionManager) GetLanguagePreferences(key string) (preferred string, last string)
func (*SessionManager) GetOrCreate ¶
func (sm *SessionManager) GetOrCreate(key string) *Session
func (*SessionManager) GetSummary ¶
func (sm *SessionManager) GetSummary(key string) string
func (*SessionManager) Keys ¶
func (sm *SessionManager) Keys() []string
func (*SessionManager) List ¶
func (sm *SessionManager) List(limit int) []Session
func (*SessionManager) Save ¶
func (sm *SessionManager) Save(session *Session) error
func (*SessionManager) SetLastLanguage ¶
func (sm *SessionManager) SetLastLanguage(key, lang string)
func (*SessionManager) SetPreferredLanguage ¶
func (sm *SessionManager) SetPreferredLanguage(key, lang string)
Click to show internal directories.
Click to hide internal directories.