diff options
author | Grail Finder <wohilas@gmail.com> | 2024-11-24 17:39:52 +0300 |
---|---|---|
committer | Grail Finder <wohilas@gmail.com> | 2024-11-24 17:39:52 +0300 |
commit | 5dfb5584767e56180771ca08c4c27def3b2db536 (patch) | |
tree | 388ce3205db9f1bb615da305926574bdfe58437b /storage/memory.go | |
parent | 6625a8103bb70833e2399567cbbe7f3b4a8da429 (diff) |
Diffstat (limited to 'storage/memory.go')
-rw-r--r-- | storage/memory.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/storage/memory.go b/storage/memory.go index a7bf8cc..088ce1c 100644 --- a/storage/memory.go +++ b/storage/memory.go @@ -12,12 +12,14 @@ func (p ProviderSQL) Memorise(m *models.Memory) (*models.Memory, error) { query := "INSERT INTO memories (agent, topic, mind) VALUES (:agent, :topic, :mind) RETURNING *;" stmt, err := p.db.PrepareNamed(query) if err != nil { + p.logger.Error("failed to prepare stmt", "query", query, "error", err) return nil, err } defer stmt.Close() var memory models.Memory err = stmt.Get(&memory, m) if err != nil { + p.logger.Error("failed to insert memory", "query", query, "error", err) return nil, err } return &memory, nil @@ -28,6 +30,7 @@ func (p ProviderSQL) Recall(agent, topic string) (string, error) { var mind string err := p.db.Get(&mind, query, agent, topic) if err != nil { + p.logger.Error("failed to get memory", "query", query, "error", err) return "", err } return mind, nil @@ -38,6 +41,7 @@ func (p ProviderSQL) RecallTopics(agent string) ([]string, error) { var topics []string err := p.db.Select(&topics, query, agent) if err != nil { + p.logger.Error("failed to get topics", "query", query, "error", err) return nil, err } return topics, nil |