Documentation
¶
Index ¶
- Variables
- type ApiRequest
- func (g *ApiRequest) AddToQueue(ctx context.Context) error
- func (g *ApiRequest) CleanRequest() error
- func (req *ApiRequest) GetLogTags() string
- func (req *ApiRequest) LogWithTags(ctx context.Context, msg ...string)
- func (g *ApiRequest) MakeBatch() <-chan *ApiRequest
- func (g *ApiRequest) ToGenerateRequestV2() GenerateRequestV2
- func (g *ApiRequest) Validate() error
- type GenerateRequestV2
- func (req *GenerateRequestV2) GetLogTags() string
- func (req *GenerateRequestV2) LogWithTags(ctx context.Context, msg ...string)
- func (g *GenerateRequestV2) MakeBatch(size int64) <-chan *GenerateRequestV2
- func (genRequest *GenerateRequestV2) SendToApi(ctx context.Context) error
- func (g *GenerateRequestV2) Validate() error
- type HRArgs
- type HRParams
- type ImageBatch
- type ImageDetailResponse
- type ImageGroup
- type ImageMetadata
- type ImageModel
- type ImageModels
- type ImageParams
- type ImageToImageParams
- type IngestArgs
- type LoraVersionReference
- type ModelReference
- type ModelVersionReference
- type PutHrParams
- type PutImage
- type PutImageDetails
- type PutImageMetadata
- type SDNextArgs
- type SharedArgs
- type SharedParams
- type WebuiResponse
Constants ¶
This section is empty.
Variables ¶
var AddHeaders = utils.AuthedRequest
Functions ¶
This section is empty.
Types ¶
type ApiRequest ¶
type ApiRequest struct {
WebuiResponse
IngestArgs
NIter int64 `json:"n_iter,omitempty" validate:"omitempty"`
Hide bool `json:"hide" validate:"omitempty,boolean"`
CheckpointModel *ModelVersionReference `json:"checkpoint_model" validate:"required_without=SdModelCheckpoint"`
LoraModels []LoraVersionReference `json:"lora_models,omitempty" validate:"omitempty"`
GroupId string `json:"group_id" validate:"required"`
HrCheckpointModel *ModelVersionReference `json:"hr_checkpoint_model,omitempty" validate:"omitempty,required_if=EnableHr true"`
HrLoraModels []LoraVersionReference `json:"hr_lora_models,omitempty" validate:"omitempty,dive,excluded_unless=EnableHr true"`
}
Recived from frontend & sent to sd-api
func (*ApiRequest) AddToQueue ¶
func (g *ApiRequest) AddToQueue(ctx context.Context) error
func (*ApiRequest) CleanRequest ¶
func (g *ApiRequest) CleanRequest() error
clean the request, do this before putting on message queue, public to simplify mocking/testing a bit
func (*ApiRequest) GetLogTags ¶
func (req *ApiRequest) GetLogTags() string
func (*ApiRequest) LogWithTags ¶
func (req *ApiRequest) LogWithTags(ctx context.Context, msg ...string)
func (*ApiRequest) MakeBatch ¶
func (g *ApiRequest) MakeBatch() <-chan *ApiRequest
func (*ApiRequest) ToGenerateRequestV2 ¶
func (g *ApiRequest) ToGenerateRequestV2() GenerateRequestV2
TOOD: replace ApiRequest with GenerateRequestV2 on endpoint eventually
func (*ApiRequest) Validate ¶
func (g *ApiRequest) Validate() error
type GenerateRequestV2 ¶
type GenerateRequestV2 struct {
GroupId string `json:"group_id,omitempty" validate:"omitempty"`
HrImageParams *HRParams `json:"hr_image_params,omitempty" validate:"omitempty"`
Image ImageParams `json:"image" validate:"required"`
ImageMetadata ImageMetadata `json:"image_metadata" validate:"required"`
ImageToImageParams *ImageToImageParams `json:"image_to_image_params,omitempty" validate:"omitempty"`
Models []ModelReference `json:"models"`
}
Post request to sd-api
func (*GenerateRequestV2) GetLogTags ¶
func (req *GenerateRequestV2) GetLogTags() string
func (*GenerateRequestV2) LogWithTags ¶
func (req *GenerateRequestV2) LogWithTags(ctx context.Context, msg ...string)
func (*GenerateRequestV2) MakeBatch ¶
func (g *GenerateRequestV2) MakeBatch(size int64) <-chan *GenerateRequestV2
func (*GenerateRequestV2) SendToApi ¶
func (genRequest *GenerateRequestV2) SendToApi(ctx context.Context) error
func (*GenerateRequestV2) Validate ¶
func (g *GenerateRequestV2) Validate() error
type HRArgs ¶
type HRArgs struct {
EnableHr bool `json:"enable_hr" validate:"omitempty"`
//man composition would simplify this declaration a lot, but probably make the code more confusing
HrScale float32 `json:"hr_scale,omitempty" validate:"required_if=EnableHr true"`
HrSamplerName string `json:"hr_sampler_name,omitempty" validate:"required_if=EnableHr true"`
HrUpscaler string `json:"hr_upscaler,omitempty" validate:"required_if=EnableHr true"`
HrSecondPassSteps int32 `json:"hr_second_pass_steps,omitempty" validate:"required_if=EnableHr true"`
HrResizeX int32 `json:"hr_resize_x,omitempty" validate:"excluded_unless=EnableHr true"`
HrResizeY int32 `json:"hr_resize_y,omitempty" validate:"excluded_unless=EnableHr true"`
HrPrompt string `json:"hr_prompt,omitempty" validate:"omitempty,excluded_unless=EnableHr true"`
HrNegativePrompt string `json:"hr_negative_prompt,omitempty" validate:"omitempty,excluded_unless=EnableHr true"`
}
arguments to send when EnableHr is true
type ImageBatch ¶
type ImageDetailResponse ¶
type ImageDetailResponse struct {
Batch ImageBatch `json:"batch"`
Groups []ImageGroup `json:"groups"`
HrParams HRParams `json:"hr_params,omitempty"`
Id string `json:"id"`
Image ImageParams `json:"image"`
ImageToImageParams *ImageToImageParams `json:"image_to_image_params,omitempty" validate:"omitempty"`
Metadata ImageMetadata `json:"metadata"`
Models ImageModels `json:"models"`
Url string `json:"url"`
}
ImageDetailResponse struct for ImageDetailResponse
func GetGenerationRequestFromApi ¶
func GetGenerationRequestFromApi(ctx context.Context, genId string) (*ImageDetailResponse, error)
func (*ImageDetailResponse) UpdateStatus ¶
func (gen *ImageDetailResponse) UpdateStatus(ctx context.Context, status string) error
UpdateStatus updates the status of a generation in the API status is one of Queued, Generating, Done, Canceled, Failed, Deleted
type ImageGroup ¶
ImageGroup struct for ImageGroup
type ImageMetadata ¶
type ImageMetadata struct {
AlwaysonScripts map[string]interface{} `json:"alwayson_scripts,omitempty"`
ExtraGenerationParams string `json:"extra_generation_params,omitempty"`
Info string `json:"info,omitempty"`
ModelHash string `json:"model_hash,omitempty"`
OverrideSettings map[string]interface{} `json:"override_settings,omitempty"`
ScriptArgs []string `json:"script_args,omitempty"`
ScriptName string `json:"script_name,omitempty"`
}
type ImageModel ¶
type ImageModel struct {
ModelId string `json:"model_id"` // actually a version id
RelationshipType string `json:"relationship_type"`
Weight float32 `json:"weight,string"`
}
ImageModel struct for ImageModel
func (ImageModel) Multiplier ¶
func (m ImageModel) Multiplier() float32
func (ImageModel) VersionId ¶
func (m ImageModel) VersionId() string
type ImageModels ¶
type ImageModels struct {
Checkpoint ImageModel `json:"checkpoint"`
Controlnet *ImageModel `json:"controlnet,omitempty"`
Embeddings []ImageModel `json:"embeddings,omitempty"`
HrCheckpoint ImageModel `json:"hr_checkpoint,omitempty"`
HrLoras []ImageModel `json:"hr_loras,omitempty"`
Loras []ImageModel `json:"loras"`
}
type ImageParams ¶
type ImageParams struct {
Id string `json:"id"`
UserId string `json:"user_id"`
BatchId string `json:"batch_id"`
CfgScale float32 `json:"cfg_scale,string"`
EnableHr bool `json:"enable_hr"`
Filepath string `json:"filepath"`
Hide bool `json:"hide"`
RestoreFaces bool `json:"restore_faces"`
Seed string `json:"seed"`
SeedResizeFromH int32 `json:"seed_resize_from_h"`
SeedResizeFromW int32 `json:"seed_resize_from_w"`
Subseed string `json:"subseed"`
Tiling bool `json:"tiling"`
Type string `json:"type"`
Height int32 `json:"height"`
Width int32 `json:"width"`
ClipSkip int32 `json:"clip_skip,omitempty" validate:"omitempty"`
CfgEnd float32 `json:"cfg_end,omitempty,string" validate:"omitempty,gte=0,lte=1"`
DiffusersGuidanceRescale float32 `json:"diffusers_guidance_rescale,omitempty,string" validate:"omitempty,gte=0,lte=1"`
FullQuality bool `json:"full_quality,omitempty" validate:"omitempty"`
PagScale float32 `json:"pag_scale,omitempty,string" validate:"omitempty,gte=0,lte=1"`
PagAdaptive float32 `json:"pag_adaptive,omitempty,string" validate:"omitempty,gte=0,lte=1"`
}
type ImageToImageParams ¶
type ImageToImageParams struct {
DenoisingStrength float32 `json:"denoising_strength,omitempty"`
FirstphaseHeight int32 `json:"firstphase_height,omitempty"`
FirstphaseWidth int32 `json:"firstphase_width,omitempty"`
InpaintFullRes bool `json:"inpaint_full_res,omitempty"`
InpaintFullResPadding int32 `json:"inpaint_full_res_padding,omitempty"`
InpaintingFill int32 `json:"inpainting_fill,omitempty"`
InpaintingMaskInvert int32 `json:"inpainting_mask_invert,omitempty"`
Mask []int32 `json:"mask,omitempty"`
MaskBlur int32 `json:"mask_blur,omitempty"`
}
type IngestArgs ¶
type IngestArgs struct {
BatchId string `json:"batch_id" validate:"required,uuid"`
UserId string `json:"user_id,omitempty" validate:"required,uuid"`
// Generation Id, unneeded in request context
Id string `json:"name,omitempty" validate:"required,uuid"`
Type string `json:"type" validate:"oneof=txt2img img2img upscale"`
}
type LoraVersionReference ¶
type LoraVersionReference struct {
ModelVersionReference
Mult float32 `json:"multiplier" validate:"required"`
}
Lora Ref as passed from ui
func (LoraVersionReference) Multiplier ¶
func (m LoraVersionReference) Multiplier() float32
func (LoraVersionReference) VersionId ¶
func (m LoraVersionReference) VersionId() string
type ModelReference ¶
type ModelVersionReference ¶
type ModelVersionReference struct {
ModelId string `json:"modelUuid" validate:"required,uuid"`
Vid string `json:"versionUuid" validate:"required,uuid"`
}
Generic ModelRef as passed from ui
func (*ModelVersionReference) GetLogTags ¶
func (ref *ModelVersionReference) GetLogTags() string
func (*ModelVersionReference) LogWithTags ¶
func (req *ModelVersionReference) LogWithTags(ctx context.Context, msg ...string)
func (ModelVersionReference) VersionId ¶
func (m ModelVersionReference) VersionId() string
type PutHrParams ¶
type PutImage ¶
type PutImage struct {
Image *PutImageDetails `json:"image"`
HrParams *PutHrParams `json:"hr_params,omitempty"`
Metadata *PutImageMetadata `json:"metadata,omitempty"`
}
type PutImageDetails ¶
type PutImageMetadata ¶
type PutImageMetadata struct {
Info string `json:"info,omitempty"`
}
type SDNextArgs ¶
type SDNextArgs struct {
ClipSkip int32 `json:"clip_skip,omitempty" validate:"omitempty"`
CfgEnd float32 `json:"cfg_end,omitempty" validate:"omitempty,gte=0,lte=1"`
DiffusersGuidanceRescale float32 `json:"diffusers_guidance_rescale,omitempty" validate:"omitempty,gte=0,lte=1"`
PagScale float32 `json:"pag_scale,omitempty" validate:"omitempty,gte=0,lte=1"`
PagAdaptive float32 `json:"pag_adaptive,omitempty" validate:"omitempty,gte=0,lte=1"`
FullQuality bool `json:"full_quality,omitempty" validate:"omitempty"`
// Not sure what this is but it should be exposed elsewhere
Hidiffusion bool `json:"hidiffusion,omitempty" validate:"omitempty"`
}
New Shared parameters for the webui request after switching to sdnext
type WebuiResponse ¶
type WebuiResponse struct {
Info string `json:"info,omitempty" validate:"omitempty"`
}