midjourney

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2023 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusPending    = "Pending"
	StatusProcessing = "Pending"
	StatusCompleted  = "Completed"
	StatusFailed     = "Failed"
)
View Source
const (
	MJGenerate   string = "Generate"
	MJUpscale    string = "Upscale"
	MJMaxUpscale string = "max_upscale"
	MJVariate    string = "Variate"
	MJReset      string = "Reset"
)

Variables

This section is empty.

Functions

func CreateMsg

func CreateMsg(s *discordgo.Session, m *discordgo.MessageCreate)

func UpdateMsg

func UpdateMsg(s *discordgo.Session, m *discordgo.MessageUpdate)

Types

type JobMessage

type JobMessage struct {
	Id              string
	Action          string
	Prompt          string
	MessageImageIdx int64
	MessageId       string
	MessageHash     string
	Channel         int64
	SourceClient    string
}

JobMessage is a struct that represents the mid-journey job message. It contains the following fields: - Id: ID of the mid-journey job for the database - Action: action to be taken for the mid-journey job - Prompt: the text prompt for the mid-journey job - MessageImageIdx: index of the message image for the mid-journey job - MessageId: ID of the message for the mid-journey job - MessageHash: the hash code of the message for the mid-journey job - Channel: channel for the mid-journey job, it should match the message's channel

type MidJourney

type MidJourney struct {
	Dao    *daos.Dao
	Client *midjourney.MidJourney
}

func GetDefaultClient

func GetDefaultClient() *MidJourney

func New

func New(dao *daos.Dao) *MidJourney

func (*MidJourney) ProcessMessage

func (m *MidJourney) ProcessMessage(msg *JobMessage) (job *MjDTO, err error)

type MjDTO

type MjDTO struct {
	dtoutils.BaseModel
	Prompt           *string `json:"prompt,omitempty" db:"prompt"`
	Action           *string `json:"action,omitempty" db:"action"`
	Status           *string `json:"status,omitempty" db:"status"`
	ChannelID        *int64  `json:"channel_id,omitempty" db:"channel_id"`
	MessageImageIdx  *int64  `json:"message_image_idx,omitempty" db:"message_image_idx"`
	MessageID        *string `json:"message_id,omitempty" db:"message_id"`
	MessageHash      *string `json:"message_hash,omitempty" db:"message_hash"`
	MessageContent   *string `json:"message_content,omitempty" db:"message_content"`
	ImageName        *string `json:"image_name,omitempty" db:"image_name"`
	ImageUrl         *string `json:"image_url,omitempty" db:"image_url"`
	ImageContentType *string `json:"image_content_type,omitempty" db:"image_content_type"`
	ImageSize        *int64  `json:"image_size,omitempty" db:"image_size"`
	ImageHeight      *int64  `json:"image_height,omitempty" db:"image_height"`
	ImageWidth       *int64  `json:"image_width,omitempty" db:"image_width"`
	TelegramFileId   *string `json:"telegram_file_id,omitempty" db:"telegram_file_id"`
}

func CreateJobRecord

func CreateJobRecord(tx *daos.Dao, mj MjDTO) (*MjDTO, error)

func GetJobRecord

func GetJobRecord(tx *daos.Dao, id string) (*MjDTO, error)

func GetProcessingJobRecordByChannelIDAndStatus

func GetProcessingJobRecordByChannelIDAndStatus(tx *daos.Dao, id, status string) (*MjDTO, error)

func UpdateJobRecord

func UpdateJobRecord(tx *daos.Dao, mj MjDTO) (*MjDTO, error)

func (MjDTO) TableName

func (m MjDTO) TableName() string

type Scene

type Scene string
const (
	GenerateStart      Scene = "GenerateStart"
	GenerateProcessing Scene = "GenerateProcessing"
	GenerateEnd        Scene = "GenerateEnd"
	GenerateEditError  Scene = "GenerateEditError"
)

Jump to

Keyboard shortcuts

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