Documentation
¶
Index ¶
- type FileChatMessageStore
- func (s *FileChatMessageStore) AddChatMessage(record *api.Message) error
- func (s *FileChatMessageStore) ChatMessages() []*api.Message
- func (s *FileChatMessageStore) ClearChatMessages() error
- func (s *FileChatMessageStore) HistoryPath() string
- func (s *FileChatMessageStore) SetChatMessages(newHistory []*api.Message) error
- type InMemoryChatStore
- type Metadata
- type SessionManager
- func (sm *SessionManager) DeleteSession(id string) error
- func (sm *SessionManager) FindSessionByID(id string) (*api.Session, error)
- func (sm *SessionManager) GetLatestSession() (*api.Session, error)
- func (sm *SessionManager) ListSessions() ([]*api.Session, error)
- func (sm *SessionManager) NewSession(meta Metadata) (*api.Session, error)
- func (sm *SessionManager) UpdateLastAccessed(session *api.Session) error
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileChatMessageStore ¶
type FileChatMessageStore struct {
Path string
// contains filtered or unexported fields
}
FileChatMessageStore implements api.ChatMessageStore by persisting history to disk.
func NewFileChatMessageStore ¶
func NewFileChatMessageStore(path string) *FileChatMessageStore
NewFileChatMessageStore creates a new file-backed chat message store.
func (*FileChatMessageStore) AddChatMessage ¶
func (s *FileChatMessageStore) AddChatMessage(record *api.Message) error
AddChatMessage appends a message to the existing history on disk.
func (*FileChatMessageStore) ChatMessages ¶
func (s *FileChatMessageStore) ChatMessages() []*api.Message
ChatMessages returns all persisted chat messages.
func (*FileChatMessageStore) ClearChatMessages ¶
func (s *FileChatMessageStore) ClearChatMessages() error
ClearChatMessages truncates the history file, leaving an empty array.
func (*FileChatMessageStore) HistoryPath ¶
func (s *FileChatMessageStore) HistoryPath() string
HistoryPath returns the location of the history file for this session.
func (*FileChatMessageStore) SetChatMessages ¶
func (s *FileChatMessageStore) SetChatMessages(newHistory []*api.Message) error
SetChatMessages replaces the history file with the provided messages.
type InMemoryChatStore ¶
type InMemoryChatStore struct {
// contains filtered or unexported fields
}
InMemoryChatStore is an in-memory implementation of the api.ChatMessageStore interface. It stores chat messages in a slice and is safe for concurrent use.
func NewInMemoryChatStore ¶
func NewInMemoryChatStore() *InMemoryChatStore
NewInMemoryChatStore creates a new InMemoryChatStore.
func (*InMemoryChatStore) AddChatMessage ¶
func (s *InMemoryChatStore) AddChatMessage(record *api.Message) error
AddChatMessage adds a message to the store.
func (*InMemoryChatStore) ChatMessages ¶
func (s *InMemoryChatStore) ChatMessages() []*api.Message
ChatMessages returns all chat messages from the store.
func (*InMemoryChatStore) ClearChatMessages ¶
func (s *InMemoryChatStore) ClearChatMessages() error
ClearChatMessages removes all messages from the store.
func (*InMemoryChatStore) SetChatMessages ¶
func (s *InMemoryChatStore) SetChatMessages(newHistory []*api.Message) error
SetChatMessages replaces the entire chat history with a new one.
type Metadata ¶
type SessionManager ¶
type SessionManager struct {
// contains filtered or unexported fields
}
func NewSessionManager ¶
func NewSessionManager(backend string) (*SessionManager, error)
func (*SessionManager) DeleteSession ¶
func (sm *SessionManager) DeleteSession(id string) error
func (*SessionManager) FindSessionByID ¶
func (sm *SessionManager) FindSessionByID(id string) (*api.Session, error)
func (*SessionManager) GetLatestSession ¶
func (sm *SessionManager) GetLatestSession() (*api.Session, error)
func (*SessionManager) ListSessions ¶
func (sm *SessionManager) ListSessions() ([]*api.Session, error)
func (*SessionManager) NewSession ¶
func (sm *SessionManager) NewSession(meta Metadata) (*api.Session, error)
func (*SessionManager) UpdateLastAccessed ¶
func (sm *SessionManager) UpdateLastAccessed(session *api.Session) error
Source Files
¶
- filesystem.go
- manager.go
- memory.go
- store.go