dialogue

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreatedEvent

type CreatedEvent struct {
	Data    Dialogue
	Result  Dialogue
	Sender  user.User
	Session session.Session
}

func NewCreatedEvent

func NewCreatedEvent(ctx context.Context, data Dialogue, result Dialogue) (*CreatedEvent, error)

type DeletedEvent

type DeletedEvent struct {
	Result  Dialogue
	Sender  user.User
	Session session.Session
}

func NewDeletedEvent

func NewDeletedEvent(ctx context.Context, result Dialogue) (*DeletedEvent, error)

type Dialogue

type Dialogue struct {
	Id        int64
	UserID    uint
	Label     string
	Messages  Messages `gorm:"type:jsonb"`
	CreatedAt time.Time
	UpdatedAt time.Time
}

func (*Dialogue) AddMessage

func (d *Dialogue) AddMessage(msg openai.ChatCompletionMessage)

func (*Dialogue) ToGraph

func (d *Dialogue) ToGraph() (*model.Dialogue, error)

type Messages

type Messages []openai.ChatCompletionMessage

func (*Messages) Scan

func (j *Messages) Scan(value interface{}) error

Scan scan value into Jsonb, implements sql.Scanner interface.

func (Messages) Value

func (j Messages) Value() (driver.Value, error)

Value return json value, implement driver.Valuer interface.

type Reply

type Reply struct {
	Message string
	Model   *string
}

type Repository

type Repository interface {
	Count(ctx context.Context) (int64, error)
	GetAll(ctx context.Context) ([]*Dialogue, error)
	GetPaginated(ctx context.Context, limit, offset int, sortBy []string) ([]*Dialogue, error)
	GetByID(ctx context.Context, id int64) (*Dialogue, error)
	GetByUserID(ctx context.Context, userID int64) ([]*Dialogue, error)
	Create(ctx context.Context, upload *Dialogue) error
	Update(ctx context.Context, upload *Dialogue) error
	Delete(ctx context.Context, id int64) error
}

type Start

type Start struct {
	Message string
	Model   string
}

func NewDialogue

func NewDialogue(message string, model *string) *Start

type UpdatedEvent

type UpdatedEvent struct {
	Data    Dialogue
	Result  Dialogue
	Sender  user.User
	Session session.Session
}

func NewUpdatedEvent

func NewUpdatedEvent(ctx context.Context, data Dialogue, result Dialogue) (*UpdatedEvent, error)

Jump to

Keyboard shortcuts

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