database

package
v0.0.0-...-a5430b0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2025 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChatOverride

type ChatOverride struct {
	ID           uint  `gorm:"primaryKey;autoIncrement"`
	ChatID       int64 `gorm:"unique"`
	ChatTitle    string
	BaseURL      string
	APIKey       string
	Model        string
	Options      string
	SystemPrompt string
}

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewDatabaseManager

func NewDatabaseManager(dbPath string) (*Manager, error)

func (*Manager) ClearMessages

func (dm *Manager) ClearMessages(chatID int64) error

func (*Manager) DeleteChatOverride

func (dm *Manager) DeleteChatOverride(chatID int64) error

func (*Manager) GetChatOverride

func (dm *Manager) GetChatOverride(chatID int64) (ChatOverride, error)

func (*Manager) GetGlobalChatOverride

func (dm *Manager) GetGlobalChatOverride() (ChatOverride, error)

func (*Manager) GetMessages

func (dm *Manager) GetMessages(chatID int64, limit int) ([]Message, error)

func (*Manager) IsChatTrusted

func (dm *Manager) IsChatTrusted(chatID int64) bool

func (*Manager) SetChatOverride

func (dm *Manager) SetChatOverride(
	chatID int64,
	chatTitle string,
	baseURL string,
	apiKey string,
	model string,
	options string,
	systemPrompt string,
) error

func (*Manager) StoreMessage

func (dm *Manager) StoreMessage(
	chatID int64,
	chatTitle string,
	role string,
	userID int64,
	username string,
	firstName string,
	lastName string,
	messageText string,
) error

type Message

type Message struct {
	ID        uint      `gorm:"primaryKey;autoIncrement"`
	Timestamp time.Time `gorm:"autoCreateTime"`
	ChatID    int64     `gorm:"index"`
	ChatTitle string
	Role      string
	UserID    int64
	Username  string
	FirstName string
	LastName  string
	Content   string
}

type TrustedChat

type TrustedChat struct {
	ID        uint   `gorm:"primaryKey;autoIncrement"`
	ChatID    int64  `gorm:"unique"`
	ChatTitle string `gorm:"unique"`
}

Jump to

Keyboard shortcuts

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