Documentation
¶
Index ¶
- type Session
- type SessionCompactionSnapshot
- type SessionManager
- func (sm *SessionManager) AddMessage(sessionKey, role, content string)
- func (sm *SessionManager) AddMessageFull(sessionKey string, msg providers.Message)
- func (sm *SessionManager) ApplyCompaction(key string, keep []providers.Message, summary string) bool
- func (sm *SessionManager) ApplyCompactionIfUnchanged(key string, baseNextSeq int, baseSummary string, keep []providers.Message, ...) bool
- func (sm *SessionManager) CompactSession(key string, keepLast int, note string) bool
- func (sm *SessionManager) CompactionSnapshot(key string) SessionCompactionSnapshot
- func (sm *SessionManager) Count() int
- func (sm *SessionManager) GetHistory(key string) []providers.Message
- func (sm *SessionManager) GetHistoryWindow(key string, around, before, after, limit int) []providers.Message
- func (sm *SessionManager) GetLanguagePreferences(key string) (preferred string, last string)
- func (sm *SessionManager) GetOrCreate(key string) *Session
- func (sm *SessionManager) GetPromptHistory(key string) []providers.Message
- 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) Search(query string, kinds []string, excludeKey string, limit int) []SessionSearchResult
- func (sm *SessionManager) SetLastLanguage(key, lang string)
- func (sm *SessionManager) SetPreferredLanguage(key, lang string)
- func (sm *SessionManager) SetSummary(key, summary string)
- type SessionSearchResult
- type SessionSearchSnippet
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 SessionCompactionSnapshot ¶ added in v1.1.0
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) ApplyCompaction ¶ added in v1.1.0
func (*SessionManager) ApplyCompactionIfUnchanged ¶ added in v1.1.0
func (*SessionManager) CompactSession ¶
func (sm *SessionManager) CompactSession(key string, keepLast int, note string) bool
func (*SessionManager) CompactionSnapshot ¶ added in v1.1.0
func (sm *SessionManager) CompactionSnapshot(key string) SessionCompactionSnapshot
func (*SessionManager) Count ¶
func (sm *SessionManager) Count() int
func (*SessionManager) GetHistory ¶
func (sm *SessionManager) GetHistory(key string) []providers.Message
func (*SessionManager) GetHistoryWindow ¶ added in v1.1.0
func (sm *SessionManager) GetHistoryWindow(key string, around, before, after, limit int) []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) GetPromptHistory ¶ added in v1.1.0
func (sm *SessionManager) GetPromptHistory(key string) []providers.Message
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) Search ¶ added in v1.1.0
func (sm *SessionManager) Search(query string, kinds []string, excludeKey string, limit int) []SessionSearchResult
func (*SessionManager) SetLastLanguage ¶
func (sm *SessionManager) SetLastLanguage(key, lang string)
func (*SessionManager) SetPreferredLanguage ¶
func (sm *SessionManager) SetPreferredLanguage(key, lang string)
func (*SessionManager) SetSummary ¶
func (sm *SessionManager) SetSummary(key, summary string)
type SessionSearchResult ¶ added in v1.1.0
Click to show internal directories.
Click to hide internal directories.