Documentation
¶
Index ¶
- type DashboardStats
- type Fact
- type FactHistory
- type FactHistoryFilter
- type FactHistoryRepository
- type FactHistoryResult
- type FactRepository
- type FactStats
- type LogRepository
- type MemoryBankRepository
- type MergeCandidate
- type Message
- type MessageRepository
- type RAGLog
- type SQLiteStore
- func (s *SQLiteStore) AddFact(fact Fact) (int64, error)
- func (s *SQLiteStore) AddFactHistory(h FactHistory) error
- func (s *SQLiteStore) AddMessageToHistory(userID int64, message Message) error
- func (s *SQLiteStore) AddRAGLog(log RAGLog) error
- func (s *SQLiteStore) AddStat(stat Stat) error
- func (s *SQLiteStore) AddTopic(topic Topic) (int64, error)
- func (s *SQLiteStore) ClearHistory(userID int64) error
- func (s *SQLiteStore) Close() error
- func (s *SQLiteStore) CreateTopic(topic Topic) (int64, error)
- func (s *SQLiteStore) DeleteFact(userID, id int64) error
- func (s *SQLiteStore) DeleteTopic(id int64) error
- func (s *SQLiteStore) DeleteTopicCascade(id int64) error
- func (s *SQLiteStore) GetAllFacts() ([]Fact, error)
- func (s *SQLiteStore) GetAllTopics() ([]Topic, error)
- func (s *SQLiteStore) GetAllUsers() ([]User, error)
- func (s *SQLiteStore) GetDashboardStats(userID int64) (*DashboardStats, error)
- func (s *SQLiteStore) GetFactHistory(userID int64, limit int) ([]FactHistory, error)
- func (s *SQLiteStore) GetFactHistoryExtended(filter FactHistoryFilter, limit, offset int, sortBy, sortDir string) (FactHistoryResult, error)
- func (s *SQLiteStore) GetFactStats() (FactStats, error)
- func (s *SQLiteStore) GetFacts(userID int64) ([]Fact, error)
- func (s *SQLiteStore) GetFactsByIDs(ids []int64) ([]Fact, error)
- func (s *SQLiteStore) GetLastTopicEndMessageID(userID int64) (int64, error)
- func (s *SQLiteStore) GetMemoryBank(userID int64) (string, error)
- func (s *SQLiteStore) GetMergeCandidates(userID int64) ([]MergeCandidate, error)
- func (s *SQLiteStore) GetMessagesByIDs(ids []int64) ([]Message, error)
- func (s *SQLiteStore) GetMessagesInRange(ctx context.Context, userID int64, startID, endID int64) ([]Message, error)
- func (s *SQLiteStore) GetRAGLogs(userID int64, limit int) ([]RAGLog, error)
- func (s *SQLiteStore) GetRecentHistory(userID int64, limit int) ([]Message, error)
- func (s *SQLiteStore) GetStats() (map[int64]Stat, error)
- func (s *SQLiteStore) GetTopicExtractionLogs(limit, offset int) ([]RAGLog, int, error)
- func (s *SQLiteStore) GetTopics(userID int64) ([]Topic, error)
- func (s *SQLiteStore) GetTopicsExtended(filter TopicFilter, limit, offset int, sortBy, sortDir string) (TopicResult, error)
- func (s *SQLiteStore) GetTopicsPendingFacts(userID int64) ([]Topic, error)
- func (s *SQLiteStore) GetUnprocessedMessages(userID int64) ([]Message, error)
- func (s *SQLiteStore) ImportMessage(userID int64, message Message) error
- func (s *SQLiteStore) Init() error
- func (s *SQLiteStore) ResetUserData(userID int64) error
- func (s *SQLiteStore) SetTopicConsolidationChecked(topicID int64, checked bool) error
- func (s *SQLiteStore) SetTopicFactsExtracted(topicID int64, extracted bool) error
- func (s *SQLiteStore) UpdateFact(fact Fact) error
- func (s *SQLiteStore) UpdateFactHistoryTopic(oldTopicID, newTopicID int64) error
- func (s *SQLiteStore) UpdateFactTopic(oldTopicID, newTopicID int64) error
- func (s *SQLiteStore) UpdateMemoryBank(userID int64, content string) error
- func (s *SQLiteStore) UpdateMessageTopic(messageID, topicID int64) error
- func (s *SQLiteStore) UpsertUser(user User) error
- type Stat
- type StatsRepository
- type Storage
- type Topic
- type TopicExtended
- type TopicFilter
- type TopicRepository
- type TopicResult
- type User
- type UserRepository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DashboardStats ¶
type DashboardStats struct {
TotalTopics int
AvgTopicSize float64
ProcessedTopicsPct float64
ConsolidatedTopics int
TotalFacts int
FactsByCategory map[string]int
FactsByType map[string]int
TotalMessages int
UnprocessedMessages int
TotalRAGQueries int
AvgRAGCost float64
MessagesPerDay map[string]int
FactsGrowth map[string]int
}
type FactHistory ¶
type FactHistoryFilter ¶
type FactHistoryRepository ¶
type FactHistoryRepository interface {
AddFactHistory(history FactHistory) error
UpdateFactHistoryTopic(oldTopicID, newTopicID int64) error
GetFactHistory(userID int64, limit int) ([]FactHistory, error)
GetFactHistoryExtended(filter FactHistoryFilter, limit, offset int, sortBy, sortDir string) (FactHistoryResult, error)
}
FactHistoryRepository handles fact history operations.
type FactHistoryResult ¶
type FactHistoryResult struct {
Data []FactHistory
TotalCount int
}
type FactRepository ¶
type FactRepository interface {
AddFact(fact Fact) (int64, error)
GetFacts(userID int64) ([]Fact, error)
GetFactsByIDs(ids []int64) ([]Fact, error)
GetAllFacts() ([]Fact, error)
GetFactStats() (FactStats, error)
UpdateFact(fact Fact) error
UpdateFactTopic(oldTopicID, newTopicID int64) error
DeleteFact(userID, id int64) error
}
FactRepository handles fact operations.
type LogRepository ¶
type LogRepository interface {
AddRAGLog(log RAGLog) error
GetRAGLogs(userID int64, limit int) ([]RAGLog, error)
GetTopicExtractionLogs(limit, offset int) ([]RAGLog, int, error)
}
LogRepository handles RAG log operations.
type MemoryBankRepository ¶
type MemoryBankRepository interface {
GetMemoryBank(userID int64) (string, error)
UpdateMemoryBank(userID int64, content string) error
}
MemoryBankRepository handles the legacy memory bank.
type MergeCandidate ¶
type MessageRepository ¶
type MessageRepository interface {
AddMessageToHistory(userID int64, message Message) error
ImportMessage(userID int64, message Message) error
GetRecentHistory(userID int64, limit int) ([]Message, error)
GetMessagesByIDs(ids []int64) ([]Message, error)
ClearHistory(userID int64) error
GetMessagesInRange(ctx context.Context, userID int64, startID, endID int64) ([]Message, error)
UpdateMessageTopic(messageID, topicID int64) error
GetUnprocessedMessages(userID int64) ([]Message, error)
}
MessageRepository handles message history operations.
type RAGLog ¶
type RAGLog struct {
ID int64
UserID int64
OriginalQuery string
EnrichedQuery string
EnrichmentPrompt string
ContextUsed string // The full context sent to the generation model
SystemPrompt string
RetrievalResults string // JSON array of retrieved messages
LLMResponse string
EnrichmentTokens int
GenerationTokens int
TotalCostUSD float64
CreatedAt time.Time
}
type SQLiteStore ¶
type SQLiteStore struct {
// contains filtered or unexported fields
}
func NewSQLiteStore ¶
func NewSQLiteStore(logger *slog.Logger, path string) (*SQLiteStore, error)
func (*SQLiteStore) AddFactHistory ¶
func (s *SQLiteStore) AddFactHistory(h FactHistory) error
func (*SQLiteStore) AddMessageToHistory ¶
func (s *SQLiteStore) AddMessageToHistory(userID int64, message Message) error
func (*SQLiteStore) AddRAGLog ¶
func (s *SQLiteStore) AddRAGLog(log RAGLog) error
func (*SQLiteStore) AddStat ¶
func (s *SQLiteStore) AddStat(stat Stat) error
func (*SQLiteStore) ClearHistory ¶
func (s *SQLiteStore) ClearHistory(userID int64) error
func (*SQLiteStore) Close ¶
func (s *SQLiteStore) Close() error
func (*SQLiteStore) CreateTopic ¶
func (s *SQLiteStore) CreateTopic(topic Topic) (int64, error)
func (*SQLiteStore) DeleteFact ¶
func (s *SQLiteStore) DeleteFact(userID, id int64) error
func (*SQLiteStore) DeleteTopic ¶
func (s *SQLiteStore) DeleteTopic(id int64) error
func (*SQLiteStore) DeleteTopicCascade ¶
func (s *SQLiteStore) DeleteTopicCascade(id int64) error
func (*SQLiteStore) GetAllFacts ¶
func (s *SQLiteStore) GetAllFacts() ([]Fact, error)
func (*SQLiteStore) GetAllTopics ¶
func (s *SQLiteStore) GetAllTopics() ([]Topic, error)
func (*SQLiteStore) GetAllUsers ¶
func (s *SQLiteStore) GetAllUsers() ([]User, error)
func (*SQLiteStore) GetDashboardStats ¶
func (s *SQLiteStore) GetDashboardStats(userID int64) (*DashboardStats, error)
func (*SQLiteStore) GetFactHistory ¶
func (s *SQLiteStore) GetFactHistory(userID int64, limit int) ([]FactHistory, error)
func (*SQLiteStore) GetFactHistoryExtended ¶
func (s *SQLiteStore) GetFactHistoryExtended(filter FactHistoryFilter, limit, offset int, sortBy, sortDir string) (FactHistoryResult, error)
func (*SQLiteStore) GetFactStats ¶
func (s *SQLiteStore) GetFactStats() (FactStats, error)
func (*SQLiteStore) GetFactsByIDs ¶
func (s *SQLiteStore) GetFactsByIDs(ids []int64) ([]Fact, error)
func (*SQLiteStore) GetLastTopicEndMessageID ¶
func (s *SQLiteStore) GetLastTopicEndMessageID(userID int64) (int64, error)
func (*SQLiteStore) GetMemoryBank ¶
func (s *SQLiteStore) GetMemoryBank(userID int64) (string, error)
func (*SQLiteStore) GetMergeCandidates ¶
func (s *SQLiteStore) GetMergeCandidates(userID int64) ([]MergeCandidate, error)
func (*SQLiteStore) GetMessagesByIDs ¶
func (s *SQLiteStore) GetMessagesByIDs(ids []int64) ([]Message, error)
func (*SQLiteStore) GetMessagesInRange ¶
func (*SQLiteStore) GetRAGLogs ¶
func (s *SQLiteStore) GetRAGLogs(userID int64, limit int) ([]RAGLog, error)
func (*SQLiteStore) GetRecentHistory ¶
func (s *SQLiteStore) GetRecentHistory(userID int64, limit int) ([]Message, error)
func (*SQLiteStore) GetTopicExtractionLogs ¶
func (s *SQLiteStore) GetTopicExtractionLogs(limit, offset int) ([]RAGLog, int, error)
func (*SQLiteStore) GetTopicsExtended ¶
func (s *SQLiteStore) GetTopicsExtended(filter TopicFilter, limit, offset int, sortBy, sortDir string) (TopicResult, error)
func (*SQLiteStore) GetTopicsPendingFacts ¶
func (s *SQLiteStore) GetTopicsPendingFacts(userID int64) ([]Topic, error)
func (*SQLiteStore) GetUnprocessedMessages ¶
func (s *SQLiteStore) GetUnprocessedMessages(userID int64) ([]Message, error)
func (*SQLiteStore) ImportMessage ¶
func (s *SQLiteStore) ImportMessage(userID int64, message Message) error
func (*SQLiteStore) Init ¶
func (s *SQLiteStore) Init() error
func (*SQLiteStore) ResetUserData ¶
func (s *SQLiteStore) ResetUserData(userID int64) error
func (*SQLiteStore) SetTopicConsolidationChecked ¶
func (s *SQLiteStore) SetTopicConsolidationChecked(topicID int64, checked bool) error
func (*SQLiteStore) SetTopicFactsExtracted ¶
func (s *SQLiteStore) SetTopicFactsExtracted(topicID int64, extracted bool) error
func (*SQLiteStore) UpdateFact ¶
func (s *SQLiteStore) UpdateFact(fact Fact) error
func (*SQLiteStore) UpdateFactHistoryTopic ¶
func (s *SQLiteStore) UpdateFactHistoryTopic(oldTopicID, newTopicID int64) error
func (*SQLiteStore) UpdateFactTopic ¶
func (s *SQLiteStore) UpdateFactTopic(oldTopicID, newTopicID int64) error
func (*SQLiteStore) UpdateMemoryBank ¶
func (s *SQLiteStore) UpdateMemoryBank(userID int64, content string) error
func (*SQLiteStore) UpdateMessageTopic ¶
func (s *SQLiteStore) UpdateMessageTopic(messageID, topicID int64) error
func (*SQLiteStore) UpsertUser ¶
func (s *SQLiteStore) UpsertUser(user User) error
type StatsRepository ¶
type StatsRepository interface {
AddStat(stat Stat) error
GetStats() (map[int64]Stat, error)
GetDashboardStats(userID int64) (*DashboardStats, error)
}
StatsRepository handles usage statistics.
type Storage ¶
type Storage interface {
MessageRepository
UserRepository
StatsRepository
LogRepository
TopicRepository
MemoryBankRepository
FactRepository
FactHistoryRepository
}
type TopicExtended ¶
type TopicFilter ¶
type TopicRepository ¶
type TopicRepository interface {
AddTopic(topic Topic) (int64, error)
CreateTopic(topic Topic) (int64, error)
DeleteTopic(id int64) error
DeleteTopicCascade(id int64) error
GetLastTopicEndMessageID(userID int64) (int64, error)
GetAllTopics() ([]Topic, error)
GetTopics(userID int64) ([]Topic, error)
SetTopicFactsExtracted(topicID int64, extracted bool) error
SetTopicConsolidationChecked(topicID int64, checked bool) error
GetTopicsPendingFacts(userID int64) ([]Topic, error)
GetTopicsExtended(filter TopicFilter, limit, offset int, sortBy, sortDir string) (TopicResult, error)
GetMergeCandidates(userID int64) ([]MergeCandidate, error)
}
TopicRepository handles topic operations.
type TopicResult ¶
type TopicResult struct {
Data []TopicExtended
TotalCount int
}
Click to show internal directories.
Click to hide internal directories.