summaryrefslogtreecommitdiff
path: root/storage/storage.go
diff options
context:
space:
mode:
authorGrail Finder <wohilas@gmail.com>2025-01-15 16:46:59 +0300
committerGrail Finder <wohilas@gmail.com>2025-01-15 16:46:59 +0300
commit1ea19ba11ec835370399fce9de3954ca2f58829c (patch)
tree0d613f1418bb04fd03e36146177e952192391923 /storage/storage.go
parent85f96aa4013f9cedaf333c6d1027fe6d901cf561 (diff)
Feat (status line): add model name
Diffstat (limited to 'storage/storage.go')
-rw-r--r--storage/storage.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/storage/storage.go b/storage/storage.go
index cfaaf0a..f759700 100644
--- a/storage/storage.go
+++ b/storage/storage.go
@@ -18,6 +18,7 @@ type FullRepo interface {
type ChatHistory interface {
ListChats() ([]models.Chat, error)
GetChatByID(id uint32) (*models.Chat, error)
+ GetChatByChar(char string) ([]models.Chat, error)
GetLastChat() (*models.Chat, error)
GetLastChatByAgent(agent string) (*models.Chat, error)
UpsertChat(chat *models.Chat) (*models.Chat, error)
@@ -37,6 +38,12 @@ func (p ProviderSQL) ListChats() ([]models.Chat, error) {
return resp, err
}
+func (p ProviderSQL) GetChatByChar(char string) ([]models.Chat, error) {
+ resp := []models.Chat{}
+ err := p.db.Select(&resp, "SELECT * FROM chats WHERE agent=$1;", char)
+ return resp, err
+}
+
func (p ProviderSQL) GetChatByID(id uint32) (*models.Chat, error) {
resp := models.Chat{}
err := p.db.Get(&resp, "SELECT * FROM chats WHERE id=$1;", id)