Feat (status line): add model name

This commit is contained in:
Grail Finder
2025-01-15 16:46:59 +03:00
parent 85f96aa401
commit 1ea19ba11e
7 changed files with 66 additions and 35 deletions

View File

@@ -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)