Initial State Commit

This commit is contained in:
2023-05-01 15:47:25 +03:00
commit eea5b6cdf4
26 changed files with 1002 additions and 0 deletions

82
lib/rtypes/sdnode.go Normal file
View File

@@ -0,0 +1,82 @@
package rtypes
import "fmt"
// A stable diffusion node
type SDNode struct {
URL string `json:"url"`
Port int `json:"port"`
Status bool `json:"status"`
}
func (node SDNode) GetDomainBase() string {
return fmt.Sprintf("http://%v:%v/", node.URL, node.Port)
}
func (node SDNode) GetTextToImageLink() string {
return fmt.Sprintf("%vsdapi/v1/txt2img", node.GetDomainBase())
}
type SDTextToImageRequest struct {
Prompt string `json:"prompt"` // "a beautiful blonde woman, woman, blonde, beautiful, masterpiece, illustration",
SamplerName string `json:"sampler_name"` // "Euler",
BatchSize int `json:"batch_size"` // 1,
Steps int `json:"steps"` // 25,
CfgScale float32 `json:"cfg_scale"` // 7,
Width int `json:"width"` // 512,
Height int `json:"height"` // 512,
NegativePrompt string `json:"negative_prompt"` // "ugly, destroyed, artifacts",
SamplerIndex string `json:"sampler_index"` // "Euler",
SendImages bool `json:"send_images"` // true,
SaveImages bool `json:"save_images"` // false
}
type SDTextToImageResponse struct {
Images []string `json:"images"`
Parameters SDTextToImageResponseParameters `json:"parameters"`
Info string `json:"info"`
}
type SDTextToImageResponseParameters struct {
EnableHDR bool `json:"enable_hr"` // false,
DenoisingStrength float32 `json:"denoising_strength"` // 0,
FirstphaseWidth float32 `json:"firstphase_width"` // 0,
FirstphaseHeight float32 `json:"firstphase_height"` // 0,
HrScale float32 `json:"hr_scale"` // 2,
HrUpscaler string `json:"hr_upscaler"` // null,
HrSecondPassSteps float32 `json:"hr_second_pass_steps"` // 0,
HrResizeX float32 `json:"hr_resize_x"` // 0,
HrResizeY float32 `json:"hr_resize_y"` // 0,
Prompt string `json:"prompt"` // "a beautiful blonde woman, woman, blonde, beautiful, masterpiece, illustration",
Styles []string `json:"styles"` // null,
Seed float32 `json:"seed"` // -1,
Subseed float32 `json:"subseed"` // -1,
SubseedStrength float32 `json:"subseed_strength"` // 0,
SeedResizeFromH float32 `json:"seed_resize_from_h"` // -1,
SeedResizeFromW float32 `json:"seed_resize_from_w"` // -1,
Sampler_name string `json:"sampler_name"` // "Euler",
Batch_size float32 `json:"batch_size"` // 1,
NIterations float32 `json:"n_iter"` // 1,
Steps float32 `json:"steps"` // 25,
CFGScale float32 `json:"cfg_scale"` // 7,
Width int `json:"width"` // 512,
Height int `json:"height"` // 512,
RestoreFaces bool `json:"restore_faces"` // false,
Tiling bool `json:"tiling"` // false,
DoNotSaveSamples bool `json:"do_not_save_samples"` // false,
DoNotSaveGrid bool `json:"do_not_save_grid"` // false,
NegativePrompt string `json:"negative_prompt"` // "ugly, destroyed, artifacts",
Eta string `json:"eta"` // null,
Schurn float32 `json:"s_churn"` // 0,
Stmax string `json:"s_tmax"` // null,
Stmin float32 `json:"s_tmin"` // 0,
Snoise float32 `json:"s_noise"` // 1,
OverrideSettings string `json:"override_settings"` // null,
OverrideSettingsRestoreAfterwards bool `json:"override_settings_restore_afterwards"` // true,
ScriptArgs []string `json:"script_args"` // [],
SamplerIndex string `json:"sampler_index"` // "Euler",
ScriptName string `json:"script_name"` // null,
SendImages bool `json:"send_images"` // true,
SaveImages bool `json:"save_images"` // false,
AlwaysonScripts interface{} `json:"alwayson_scripts"` // {}
}