db

package
v1.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 27, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddMessage

func AddMessage(chatID int, role, apiName, content string) error

func CloseDB

func CloseDB()

func CreateChat

func CreateChat(title string) (int, error)

func DeleteAPIKey

func DeleteAPIKey(apiName string) error

func FlushDB added in v1.3.1

func FlushDB() error

func GetAPIKey

func GetAPIKey(apiName string) (string, error)

func GetAllAPIKeys

func GetAllAPIKeys() ([]struct {
	APIName string
	APIKey  string
}, error)

func InitDB

func InitDB() error

func SetAPIKey

func SetAPIKey(apiName, apiKey string) error

Types

type Chat

type Chat struct {
	ID        int
	Title     string
	CreatedAt time.Time
	UpdatedAt time.Time
}

func GetChats

func GetChats() ([]Chat, error)

type Message

type Message struct {
	ID        int
	ChatID    int
	Role      string
	APIName   string
	Content   string
	CreatedAt time.Time
}

func GetChatMessages

func GetChatMessages(chatID int) ([]Message, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL