fix: add omitempty where needed (#671)

This commit is contained in:
Ettore Di Giacinto 2023-06-25 22:51:02 +02:00 committed by GitHub
parent 53f8d73101
commit 6213da330a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 9 deletions

View File

@ -42,7 +42,8 @@ prompt_templates:
content: "" content: ""
*/ */
// Config is the model configuration which contains all the model details
// This configuration is read from the gallery endpoint and is used to download and install the model
type Config struct { type Config struct {
Description string `yaml:"description"` Description string `yaml:"description"`
License string `yaml:"license"` License string `yaml:"license"`

View File

@ -9,15 +9,25 @@ import (
"gopkg.in/yaml.v2" "gopkg.in/yaml.v2"
) )
// endpoints // GalleryModel is the struct used to represent a model in the gallery returned by the endpoint.
// It is used to install the model by resolving the URL and downloading the files.
// The other fields are used to override the configuration of the model.
type GalleryModel struct { type GalleryModel struct {
URL string `json:"url" yaml:"url"` URL string `json:"url,omitempty" yaml:"url,omitempty"`
Name string `json:"name" yaml:"name"` Name string `json:"name,omitempty" yaml:"name,omitempty"`
Overrides map[string]interface{} `json:"overrides" yaml:"overrides"` Description string `json:"description,omitempty" yaml:"description,omitempty"`
AdditionalFiles []File `json:"files" yaml:"files"` License string `json:"license,omitempty" yaml:"license,omitempty"`
Gallery Gallery `json:"gallery" yaml:"gallery"` URLs []string `json:"urls,omitempty" yaml:"urls,omitempty"`
Installed bool `json:"installed" yaml:"installed"` Icon string `json:"icon,omitempty" yaml:"icon,omitempty"`
// Overrides are used to override the configuration of the model
Overrides map[string]interface{} `json:"overrides,omitempty" yaml:"overrides,omitempty"`
// AdditionalFiles are used to add additional files to the model
AdditionalFiles []File `json:"files,omitempty" yaml:"files,omitempty"`
// Gallery is a reference to the gallery which contains the model
Gallery Gallery `json:"gallery,omitempty" yaml:"gallery,omitempty"`
// Installed is used to indicate if the model is installed or not
Installed bool `json:"installed,omitempty" yaml:"installed,omitempty"`
} }
const ( const (