app

package
v1.7.7 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2025 License: Apache-2.0 Imports: 30 Imported by: 2

Documentation

Index

Constants

View Source
const (
	ErrorCodeSystem = "system"

	// It exceed the max times for a day.
	ErrorCodeAIQuestionExceedMaxTimes           = "aiquestion_exceed_max_times"
	ErrorCodeAIQuestionSubmissionExpiry         = "aiquestion_submission_expiry"
	ErrorCodeAIQuestionSubmissionUnmatchedTimes = "aiquestion_submission_unmatched_times"

	ErrorRepoFileTooManyFilesToDelete = "repofile_too_many_files_to_delete"

	ErrorCompetitionDuplicateSubmission = "competition_duplicate_submission"

	ErrorBigModelSensitiveInfo = "bigmodel_sensitive_info"
	ErrorBigModelRecourseBusy  = "bigmodel_resource_busy"

	ErrorTrainNoLog        = "train_no_log"
	ErrorTrainNoOutput     = "train_no_output"
	ErrorTrainNotFound     = "train_not_found"
	ErrorTrainExccedMaxNum = "train_excced_max_num" // excced max training num for a user

	ErrorWuKongInvalidId        = "wukong_invalid_id"
	ErrorWuKongInvalidOwner     = "wukong_invalid_owner"
	ErrorWuKongInvalidPath      = "wukong_invalid_path"
	ErrorWuKongNoAuthorization  = "wukong_no_authorization"
	ErrorWuKongInvalidLink      = "wukong_invalid_link"
	ErrorWuKongDuplicateLike    = "wukong_duplicate_like"
	ErrorWuKongExccedMaxLikeNum = "wukong_excced_max_like_num"

	ErrorFinetuneExpiry           = "finetune_expiry"
	ErrorFinetuneNotFound         = "finetune_not_found"
	ErrorFinetuneExccedMaxNum     = "finetune_excced_max_num"
	ErrorFinetuneNoPermission     = "finetune_no_permission"
	ErrorFinetuneRunningJobExists = "finetune_running_job_exists"

	ErrorAICCFinetuneNoLog    = "aicc_finetune_no_log"
	ErrorAICCFinetuneNotFound = "aicc_finetune_not_found"
)

Variables

This section is empty.

Functions

func GenActivityForCreatingResource added in v1.3.2

func GenActivityForCreatingResource(obj domain.ResourceObject, repotype domain.RepoType) domain.UserActivity

func GenActivityForDeletingResource added in v1.3.2

func GenActivityForDeletingResource(obj *domain.ResourceObject, repoType domain.RepoType) domain.UserActivity

func Init

func Init(cfg *Config)

func IsErrorUnavailableTraining

func IsErrorUnavailableTraining(err error) bool

Types

type AIQuestionAnswerSubmitCmd

type AIQuestionAnswerSubmitCmd struct {
	Times  int
	Result []string
	Answer string
}

type AIQuestionDTO

type AIQuestionDTO struct {
	Times       int                     `json:"times"`
	Answer      string                  `json:"answer"`
	Choices     []ChoiceQuestionDTO     `json:"choices"`
	Completions []CompletionQuestionDTO `json:"completions"`
}

type ActivityDTO

type ActivityDTO struct {
	Type     string      `json:"type"`
	Time     string      `json:"time"`
	Resource ResourceDTO `json:"resource"`
}

type ActivityService

type ActivityService interface {
	List(domain.Account, bool) ([]ActivityDTO, error)
}

func NewActivityService

func NewActivityService(
	repo repository.Activity,
	user userrepo.User,
	model repository.Model,
	project spacerepo.Project,
	dataset repository.Dataset,
) ActivityService

type ChallengeCompetitorInfoDTO

type ChallengeCompetitorInfoDTO struct {
	Score        int  `json:"score"`
	IsCompetitor bool `json:"is_competitor"`

	AIQuestionInfo struct {
		RemainingTimes int  `json:"remaining_times"`
		InProgress     bool `json:"in_progress"`
	} `json:"ai_question"`
}

type ChallengeRankingDTO

type ChallengeRankingDTO struct {
	Score      int    `json:"score"`
	Competitor string `json:"competitor"`
}

type ChallengeService

type ChallengeService interface {
	Apply(*CompetitorApplyCmd) error
	GetCompetitor(domain.Account) (ChallengeCompetitorInfoDTO, error)
	GetAIQuestions(domain.Account) (AIQuestionDTO, string, error)
	SubmitAIQuestionAnswer(domain.Account, *AIQuestionAnswerSubmitCmd) (int, string, error)
	GetRankingList() ([]ChallengeRankingDTO, error)
}

func NewChallengeService

func NewChallengeService(
	competitionRepo repository.Competition,
	aiQuestionRepo repository.AIQuestion,
	helper challenge.Challenge,
	encryption utils.SymmetricEncryption,
	userRepo userrepo.User,
) ChallengeService

type ChoiceQuestionDTO

type ChoiceQuestionDTO struct {
	Desc    string   `json:"desc"`
	Options []string `json:"options"`
}

type CodeGeexCmd

type CodeGeexCmd bigmodel.CodeGeexReq

func (*CodeGeexCmd) Validate

func (cmd *CodeGeexCmd) Validate() error

type CodeGeexDTO

type CodeGeexDTO = bigmodel.CodeGeexResp

type CompetitionAddRelatedProjectCMD added in v1.3.1

type CompetitionAddRelatedProjectCMD struct {
	Index      CompetitionIndex
	Competitor domain.Account
	Project    domain.ResourceSummary
}

type CompetitionDTO

type CompetitionDTO struct {
	CompetitionSummaryDTO

	Type       string `json:"type"`
	Phase      string `json:"phase"`
	Doc        string `json:"doc"`
	Forum      string `json:"forum"`
	Winners    string `json:"winners"`
	DatasetDoc string `json:"dataset_doc"`
	DatasetURL string `json:"dataset_url"`
}

type CompetitionIndex

type CompetitionIndex = domain.CompetitionIndex

type CompetitionInternalService

type CompetitionInternalService interface {
	UpdateSubmission(*CompetitionIndex, *CompetitionSubmissionInfo) error
}

Internal Service

func NewCompetitionInternalService

func NewCompetitionInternalService(repo repository.Competition) CompetitionInternalService

type CompetitionListCMD

type CompetitionListCMD = repository.CompetitionListOption

type CompetitionSubmissionDTO

type CompetitionSubmissionDTO struct {
	SubmitAt string  `json:"submit_at"`
	FileName string  `json:"project"`
	Status   string  `json:"status"`
	Score    float32 `json:"score"`
}

type CompetitionSubmissionInfo

type CompetitionSubmissionInfo = domain.CompetitionSubmissionInfo

type CompetitionSubmissionsDTO

type CompetitionSubmissionsDTO struct {
	RelatedProject string                     `json:"project"`
	Details        []CompetitionSubmissionDTO `json:"details"`
}

result

type CompetitionSubmitCMD

type CompetitionSubmitCMD struct {
	FileName   string
	Data       io.Reader
	Index      CompetitionIndex
	Competitor domain.Account
}

type CompetitionSummaryDTO

type CompetitionSummaryDTO struct {
	CompetitorCount int    `json:"count"`
	Bonus           int    `json:"bonus"`
	Id              string `json:"id"`
	Name            string `json:"name"`
	Host            string `json:"host"`
	Desc            string `json:"desc"`
	Status          string `json:"status"`
	Poster          string `json:"poster"`
	Duration        string `json:"duration"`
}

type CompetitionTeamDTO

type CompetitionTeamDTO struct {
	Name    string                     `json:"name"`
	Members []CompetitionTeamMemberDTO `json:"members"`
}

team

type CompetitionTeamMemberDTO

type CompetitionTeamMemberDTO struct {
	Name  string `json:"name"`
	Role  string `json:"role"`
	Email string `json:"email"`
}

type CompetitorApplyCmd

type CompetitorApplyCmd domain.CompetitorInfo

func (*CompetitorApplyCmd) Validate

func (cmd *CompetitorApplyCmd) Validate() error

type CompletionQuestionDTO

type CompletionQuestionDTO struct {
	Desc string `json:"desc"`
	Info string `json:"info"`
}

type ComputeDTO

type ComputeDTO struct {
	Type    string `json:"type"`
	Version string `json:"version"`
	Flavor  string `json:"flavor"`
}

type Config

type Config struct {
	WuKongMaxLikeNum int `json:"wukong_max_like_num"     required:"true"`
	FinetuneMaxNum   int `json:"finetune_max_num"        required:"true"`
}

func (*Config) SetDefault

func (cfg *Config) SetDefault()

type DatasetCreateCmd

type DatasetCreateCmd struct {
	Owner    domain.Account
	Name     domain.ResourceName
	Desc     domain.ResourceDesc
	Title    domain.ResourceTitle
	RepoType domain.RepoType
	Protocol domain.ProtocolName
	Tags     []string
	TagKinds []string
	All      []domain.DomainTags
}

func (*DatasetCreateCmd) Validate

func (cmd *DatasetCreateCmd) Validate() error

type DatasetDTO

type DatasetDTO struct {
	Id            string   `json:"id"`
	Owner         string   `json:"owner"`
	Name          string   `json:"name"`
	Desc          string   `json:"desc"`
	Title         string   `json:"title"`
	Protocol      string   `json:"protocol"`
	RepoType      string   `json:"repo_type"`
	RepoId        string   `json:"repo_id"`
	Tags          []string `json:"tags"`
	CreatedAt     string   `json:"created_at"`
	UpdatedAt     string   `json:"updated_at"`
	LikeCount     int      `json:"like_count"`
	DownloadCount int      `json:"download_count"`
}

type DatasetDetailDTO

type DatasetDetailDTO struct {
	DatasetDTO

	RelatedModels   []ResourceDTO `json:"related_models"`
	RelatedProjects []ResourceDTO `json:"related_projects"`
}

type DatasetMessageService

type DatasetMessageService interface {
	AddRelatedProject(*ReverselyRelatedResourceInfo) error
	RemoveRelatedProject(*ReverselyRelatedResourceInfo) error

	AddRelatedModel(*ReverselyRelatedResourceInfo) error
	RemoveRelatedModel(*ReverselyRelatedResourceInfo) error

	AddLike(*domain.ResourceIndex) error
	RemoveLike(*domain.ResourceIndex) error

	IncreaseDownload(*domain.ResourceIndex) error
}

dataset

func NewDatasetMessageService

func NewDatasetMessageService(repo repository.Dataset) DatasetMessageService

type DatasetSummaryDTO

type DatasetSummaryDTO struct {
	Id            string   `json:"id"`
	Owner         string   `json:"owner"`
	Name          string   `json:"name"`
	Desc          string   `json:"desc"`
	Title         string   `json:"title"`
	Tags          []string `json:"tags"`
	UpdatedAt     string   `json:"updated_at"`
	LikeCount     int      `json:"like_count"`
	DownloadCount int      `json:"download_count"`
}

type DatasetUpdateCmd

type DatasetUpdateCmd struct {
	Name     domain.ResourceName
	Desc     domain.ResourceDesc
	Title    domain.ResourceTitle
	RepoType domain.RepoType
}

type DatasetsDTO

type DatasetsDTO struct {
	Total    int                 `json:"total"`
	Datasets []DatasetSummaryDTO `json:"datasets"`
}

type DomainTagsDTO

type DomainTagsDTO = domain.DomainTags

type ErrorDuplicateTrainingName

type ErrorDuplicateTrainingName struct {
	// contains filtered or unexported fields
}

type ErrorExccedMaxTrainingRecord

type ErrorExccedMaxTrainingRecord struct {
	// contains filtered or unexported fields
}

type ErrorExceedMaxRelatedResourceNum

type ErrorExceedMaxRelatedResourceNum struct {
	// contains filtered or unexported fields
}

type ErrorOnlyOneRunningTraining

type ErrorOnlyOneRunningTraining struct {
	// contains filtered or unexported fields
}

type ErrorPreviewLFSFile

type ErrorPreviewLFSFile struct {
	// contains filtered or unexported fields
}

type ErrorPrivateRepo

type ErrorPrivateRepo struct {
	// contains filtered or unexported fields
}

type ErrorUnavailableRepoFile

type ErrorUnavailableRepoFile struct {
	// contains filtered or unexported fields
}

type ErrorUpdateLFSFile

type ErrorUpdateLFSFile struct {
	// contains filtered or unexported fields
}

type FinetuneConfig

type FinetuneConfig = domain.FinetuneConfig

type FinetuneCreateCmd

type FinetuneCreateCmd struct {
	User domain.Account

	domain.FinetuneConfig
}

func (*FinetuneCreateCmd) Validate

func (cmd *FinetuneCreateCmd) Validate() error

type FinetuneIndex

type FinetuneIndex = domain.FinetuneIndex

type FinetuneInternalService

type FinetuneInternalService interface {
	UpdateJobDetail(*FinetuneIndex, *FinetuneJobDetail) error
}

FinetuneInternalService

func NewFinetuneInternalService

func NewFinetuneInternalService(
	repo repository.Finetune,
) FinetuneInternalService

type FinetuneJobDTO

type FinetuneJobDTO struct {
	IsDone        bool
	LogPreviewURL string
}

type FinetuneJobDetail

type FinetuneJobDetail = domain.FinetuneJobDetail

type FinetuneMessageService

type FinetuneMessageService interface {
	CreateFinetuneJob(*FinetuneIndex, bool) (bool, error)
}

FinetuneMessageService

func NewFinetuneMessageService

func NewFinetuneMessageService(
	fs finetune.Finetune,
	repo repository.Finetune,
) FinetuneMessageService

type FinetuneService

type FinetuneService interface {
	Create(*FinetuneCreateCmd) (string, string, error)
	List(user domain.Account) (UserFinetunesDTO, string, error)
	Delete(*FinetuneIndex) error
	Terminate(*FinetuneIndex) error
	GetJobInfo(*FinetuneIndex) (FinetuneJobDTO, string, error)
}

func NewFinetuneService

func NewFinetuneService(
	fs finetune.Finetune,
	repo repository.Finetune,
	sender message.Sender,
) FinetuneService

type FinetuneSummaryDTO

type FinetuneSummaryDTO struct {
	Id        string `json:"id"`
	Name      string `json:"name"`
	Error     string `json:"error"`
	Status    string `json:"status"`
	CreatedAt string `json:"created_at"`
	IsDone    bool   `json:"is_done"`
	Duration  int    `json:"duration"`
}

type GlobalDatasetDTO

type GlobalDatasetDTO struct {
	DatasetSummaryDTO
	AvatarId string `json:"avatar_id"`
}

type GlobalDatasetsDTO

type GlobalDatasetsDTO struct {
	Total    int                `json:"total"`
	Datasets []GlobalDatasetDTO `json:"projects"`
}

Dataset

type GlobalModelDTO

type GlobalModelDTO struct {
	ModelSummaryDTO
	AvatarId string `json:"avatar_id"`
}

type GlobalModelsDTO

type GlobalModelsDTO struct {
	Total  int              `json:"total"`
	Models []GlobalModelDTO `json:"projects"`
}

Model

type GlobalResourceListCmd

type GlobalResourceListCmd struct {
	repository.GlobalResourceListOption

	SortType domain.SortType
}

func (*GlobalResourceListCmd) ToResourceListOption added in v1.3.2

func (cmd *GlobalResourceListCmd) ToResourceListOption() repository.GlobalResourceListOption

type JobDetail

type JobDetail = domain.JobDetail

type KeyValueDTO

type KeyValueDTO struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type LikeCreateCmd

type LikeCreateCmd struct {
	ResourceOwner domain.Account
	ResourceType  domain.ResourceType
	ResourceId    string
}

func (*LikeCreateCmd) Validate

func (cmd *LikeCreateCmd) Validate() error

type LikeDTO

type LikeDTO struct {
	Time     string      `json:"time"`
	Resource ResourceDTO `json:"resource"`
}

type LikeRemoveCmd

type LikeRemoveCmd = LikeCreateCmd

type LikeService

type LikeService interface {
	Create(domain.Account, LikeCreateCmd) error
	Delete(domain.Account, LikeRemoveCmd) error
	List(domain.Account) ([]LikeDTO, error)
}

func NewLikeService

func NewLikeService(
	repo repository.Like,
	user userrepo.User,
	model repository.Model,
	project spacerepo.Project,
	dataset repository.Dataset,
	activity repository.Activity,
	sender message.LikeMessageProducer,
) LikeService

type LoginCreateCmd

type LoginCreateCmd struct {
	Account domain.Account
	Info    string
	Email   domain.Email
	UserId  string
}

func (*LoginCreateCmd) Validate

func (cmd *LoginCreateCmd) Validate() error

type LoginDTO

type LoginDTO struct {
	Info   string `json:"info"`
	Email  string `json:"email"`
	UserId string `json:"user_id"`
}

type LoginService

type LoginService interface {
	Create(*LoginCreateCmd) error
	Get(domain.Account) (LoginDTO, error)
	SignIn(domain.Account) error
}

type LuoJiaRecordDTO

type LuoJiaRecordDTO struct {
	CreatedAt string `json:"created_at"`
	Id        string `json:"id"`
}

type ModelCreateCmd

type ModelCreateCmd struct {
	Owner    domain.Account
	Name     domain.ResourceName
	Desc     domain.ResourceDesc
	Title    domain.ResourceTitle
	RepoType domain.RepoType
	Protocol domain.ProtocolName
	Tags     []string
	TagKinds []string
	All      []domain.DomainTags
}

func (*ModelCreateCmd) Validate

func (cmd *ModelCreateCmd) Validate() error

type ModelDTO

type ModelDTO struct {
	Id            string   `json:"id"`
	Owner         string   `json:"owner"`
	Name          string   `json:"name"`
	Desc          string   `json:"desc"`
	Title         string   `json:"title"`
	Protocol      string   `json:"protocol"`
	RepoType      string   `json:"repo_type"`
	RepoId        string   `json:"repo_id"`
	Tags          []string `json:"tags"`
	CreatedAt     string   `json:"created_at"`
	UpdatedAt     string   `json:"updated_at"`
	LikeCount     int      `json:"like_count"`
	DownloadCount int      `json:"download_count"`
}

type ModelDetailDTO

type ModelDetailDTO struct {
	ModelDTO

	RelatedDatasets []ResourceDTO `json:"related_datasets"`
	RelatedProjects []ResourceDTO `json:"related_projects"`
}

type ModelMessageService

type ModelMessageService interface {
	AddRelatedProject(*ReverselyRelatedResourceInfo) error
	RemoveRelatedProject(*ReverselyRelatedResourceInfo) error

	AddRelatedDataset(*ReverselyRelatedResourceInfo) error
	RemoveRelatedDataset(*ReverselyRelatedResourceInfo) error

	AddLike(*domain.ResourceIndex) error
	RemoveLike(*domain.ResourceIndex) error

	IncreaseDownload(*domain.ResourceIndex) error
}

model

func NewModelMessageService

func NewModelMessageService(repo repository.Model) ModelMessageService

type ModelSummaryDTO

type ModelSummaryDTO struct {
	Id            string   `json:"id"`
	Owner         string   `json:"owner"`
	Name          string   `json:"name"`
	Desc          string   `json:"desc"`
	Title         string   `json:"title"`
	Tags          []string `json:"tags"`
	UpdatedAt     string   `json:"updated_at"`
	LikeCount     int      `json:"like_count"`
	DownloadCount int      `json:"download_count"`
}

type ModelUpdateCmd

type ModelUpdateCmd struct {
	Name     domain.ResourceName
	Desc     domain.ResourceDesc
	Title    domain.ResourceTitle
	RepoType domain.RepoType
}

type ModelsDTO

type ModelsDTO struct {
	Total  int               `json:"total"`
	Models []ModelSummaryDTO `json:"models"`
}

type ProjectMessageService

type ProjectMessageService interface {
	AddRelatedModel(*ReverselyRelatedResourceInfo) error
	RemoveRelatedModel(*ReverselyRelatedResourceInfo) error

	AddRelatedDataset(*ReverselyRelatedResourceInfo) error
	RemoveRelatedDataset(*ReverselyRelatedResourceInfo) error

	AddLike(*domain.ResourceIndex) error
	RemoveLike(*domain.ResourceIndex) error

	IncreaseFork(*domain.ResourceIndex) error
	IncreaseDownload(*domain.ResourceIndex) error
}

project

func NewProjectMessageService

func NewProjectMessageService(repo spacerepo.Project) ProjectMessageService

type RankingDTO

type RankingDTO struct {
	Score    float32 `json:"score"`
	TeamName string  `json:"team_name"`
	SubmitAt string  `json:"submit_at"`
}

ranking

type RepoDir

type RepoDir = platform.RepoDir

type RepoDirDeleteCmd

type RepoDirDeleteCmd = RepoDirInfo

type RepoDirInfo

type RepoDirInfo = platform.RepoDirInfo

type RepoFileContent

type RepoFileContent = platform.RepoFileContent

type RepoFileCreateCmd

type RepoFileCreateCmd struct {
	RepoFileInfo

	RepoFileContent
}

func (*RepoFileCreateCmd) Validate

func (cmd *RepoFileCreateCmd) Validate() error

type RepoFileDeleteCmd

type RepoFileDeleteCmd = RepoFileInfo

type RepoFileDownloadCmd

type RepoFileDownloadCmd struct {
	MyAccount domain.Account
	MyToken   string
	Path      domain.FilePath
	Type      domain.ResourceType
	Resource  domain.ResourceSummary
}

type RepoFileDownloadDTO

type RepoFileDownloadDTO struct {
	Content     string `json:"content"`
	DownloadURL string `json:"download_url"`
}

type RepoFileInfo

type RepoFileInfo = platform.RepoFileInfo

type RepoFileListCmd

type RepoFileListCmd = RepoDir

type RepoFilePreviewCmd

type RepoFilePreviewCmd = RepoFileInfo

type RepoFileService

type RepoFileService interface {
	List(u *UserInfo, d *RepoDir) ([]RepoPathItem, error)
	Create(*UserInfo, *RepoFileCreateCmd) error
	Update(*UserInfo, *RepoFileUpdateCmd) error
	Delete(*UserInfo, *RepoFileDeleteCmd) error
	Preview(*UserInfo, *RepoFilePreviewCmd) ([]byte, error)
	DeleteDir(*UserInfo, *RepoDirDeleteCmd) (string, error)
	Download(*RepoFileDownloadCmd) (RepoFileDownloadDTO, error)
	DownloadByRepoId(string, domain.FilePath) (RepoFileDownloadDTO, error)
	StreamDownload(string, domain.FilePath, func(io.Reader, int64)) error
	DownloadRepo(u *UserInfo, obj *domain.RepoDownloadedEvent, handle func(io.Reader, int64)) error
}

type RepoFileUpdateCmd

type RepoFileUpdateCmd = RepoFileCreateCmd

type RepoPathItem

type RepoPathItem = platform.RepoPathItem

type ResourceDTO

type ResourceDTO struct {
	Owner struct {
		Name     string `json:"name"`
		AvatarId string `json:"avatar_id"`
	} `json:"owner"`

	Id            string   `json:"id"`
	Name          string   `json:"name"`
	Type          string   `json:"type"`
	Desc          string   `json:"description"`
	Title         string   `json:"title"`
	CoverId       string   `json:"cover_id"`
	UpdateAt      string   `json:"update_at"`
	Tags          []string `json:"tags"`
	ResourceLevel string   `json:"level"`

	LikeCount     int `json:"like_count"`
	ForkCount     int `json:"fork_count"`
	DownloadCount int `json:"download_count"`
}

type ResourceIndexCmd

type ResourceIndexCmd = domain.ResourceIndex

type ResourceListCmd

type ResourceListCmd struct {
	repository.ResourceListOption

	SortType domain.SortType
}

func (*ResourceListCmd) ToResourceListOption added in v1.3.2

func (cmd *ResourceListCmd) ToResourceListOption() repository.ResourceListOption

type ResourceSearchDTO

type ResourceSearchDTO struct {
	Top   []ResourceSummaryDTO `json:"top"`
	Total int                  `json:"total"`
}

type ResourceService added in v1.3.2

type ResourceService struct {
	User    userrepo.User
	Model   repository.Model
	Project spacerepo.Project
	Dataset repository.Dataset
}

func (ResourceService) CanApplyResourceName added in v1.3.2

func (s ResourceService) CanApplyResourceName(owner domain.Account, name domain.ResourceName) bool

func (ResourceService) FindUserAvater added in v1.3.2

func (s ResourceService) FindUserAvater(users []userdomain.Account) ([]string, error)

func (ResourceService) IsPrivate added in v1.3.2

func (s ResourceService) IsPrivate(owner domain.Account, resourceType domain.ResourceType, id string,
) (isprivate bool, ok bool)

func (ResourceService) ListDatasets added in v1.3.2

func (s ResourceService) ListDatasets(resources []domain.ResourceIndex) (
	dtos []ResourceDTO, err error,
)

func (ResourceService) ListModels added in v1.3.2

func (s ResourceService) ListModels(resources []domain.ResourceIndex) (
	dtos []ResourceDTO, err error,
)

type ResourceSummaryDTO

type ResourceSummaryDTO struct {
	Owner string `json:"owner"`
	Name  string `json:"name"`
}

type ResourceTagsUpdateCmd

type ResourceTagsUpdateCmd struct {
	ToAdd    []string
	ToRemove []string
	All      []domain.DomainTags
}

func (*ResourceTagsUpdateCmd) GenTagKinds added in v1.3.2

func (cmd *ResourceTagsUpdateCmd) GenTagKinds(tags []string) []string

func (*ResourceTagsUpdateCmd) ToTags added in v1.3.2

func (cmd *ResourceTagsUpdateCmd) ToTags(old []string) ([]string, bool)

type ReverselyRelatedResourceInfo

type ReverselyRelatedResourceInfo = domain.ReverselyRelatedResourceInfo

type SearchDTO

type SearchDTO struct {
	User    UserSearchDTO     `json:"user"`
	Model   ResourceSearchDTO `json:"model"`
	Project ResourceSearchDTO `json:"project"`
	Dataset ResourceSearchDTO `json:"dataset"`
}

type SearchService

type SearchService interface {
	Search(name string) (dto SearchDTO)
}

func NewSearchService

func NewSearchService(
	user userrepo.User,
	model repository.Model,
	project spacerepo.Project,
	dataset repository.Dataset,
) SearchService

type TagsService

type TagsService interface {
	List([]string) ([]DomainTagsDTO, error)
}

func NewTagsService

func NewTagsService(repo repository.Tags) TagsService

type TrainingConfig

type TrainingConfig = domain.TrainingConfig

type TrainingConfigDTO

type TrainingConfigDTO struct {
	Name string `json:"name"`
	Desc string `json:"desc"`

	CodeDir  string `json:"code_dir"`
	BootFile string `json:"boot_file"`

	Hyperparameters []KeyValueDTO    `json:"hyperparameter"`
	Env             []KeyValueDTO    `json:"env"`
	Inputs          []TrainingRefDTO `json:"inputs"`
	EnableAim       bool             `json:"enable_aim"`
	EnableOutput    bool             `json:"enable_output"`

	Compute ComputeDTO `json:"compute"`
}

type TrainingCreateCmd

type TrainingCreateCmd struct {
	User      domain.Account
	ProjectId string

	domain.TrainingConfig
}

func (*TrainingCreateCmd) Validate

func (cmd *TrainingCreateCmd) Validate() error

type TrainingDTO

type TrainingDTO struct {
	Id        string `json:"id"`
	ProjectId string `json:"project_id"`

	Name string `json:"name"`
	Desc string `json:"desc"`

	IsDone    bool       `json:"is_done"`
	Error     string     `json:"error"`
	Status    string     `json:"status"`
	Duration  int        `json:"duration"`
	CreatedAt string     `json:"created_at"`
	Compute   ComputeDTO `json:"compute"`
	AimPath   string     `json:"aim_path"`
	EnableAim bool       `json:"enable_aim"`

	LogPreviewURL string `json:"-"`
}

type TrainingIndex

type TrainingIndex = domain.TrainingIndex

type TrainingRefDTO

type TrainingRefDTO struct {
	Key   string `json:"key"`
	Owner string `json:"owner"`
	File  string `json:"File"`
	Name  string `json:"name,omitempty"`
	Type  string `json:"type"`
}

type TrainingService

type TrainingService interface {
	Create(*TrainingCreateCmd) (string, error)
	Recreate(*TrainingIndex) (string, error)
	UpdateJobDetail(*TrainingIndex, *JobDetail) error
	List(user domain.Account, projectId string) ([]TrainingSummaryDTO, error)
	Get(*TrainingIndex) (TrainingDTO, string, error)
	GetLastTrainingConfig(*ResourceIndexCmd) (dto TrainingConfigDTO, code string, err error)
	Delete(*TrainingIndex) error
	Terminate(*TrainingIndex) error
	GetLogDownloadURL(*TrainingIndex) (string, string, error)
	GetOutputDownloadURL(*TrainingIndex) (string, string, error)
	CreateTrainingJob(*TrainingIndex, string, bool) (bool, error)
}

func NewTrainingService

func NewTrainingService(
	train training.Training,
	repo repository.Training,
	sender message.MessageProducer,
	maxTrainingRecordNum int,
) TrainingService

type TrainingSummaryDTO

type TrainingSummaryDTO struct {
	Id        string `json:"id"`
	Name      string `json:"name"`
	Desc      string `json:"desc"`
	Error     string `json:"error"`
	Status    string `json:"status"`
	CreatedAt string `json:"created_at"`
	IsDone    bool   `json:"is_done"`
	Duration  int    `json:"duration"`
}

type UserCompetitionDTO

type UserCompetitionDTO struct {
	IsCompetitor bool   `json:"is_competitor"`
	TeamId       string `json:"team_id"`
	TeamRole     string `json:"team_role"`

	CompetitionDTO
}

type UserFinetunesDTO

type UserFinetunesDTO struct {
	Expiry int64                `json:"expiry"`
	Data   []FinetuneSummaryDTO `json:"data"`
}

type UserInfo

type UserInfo = platform.UserInfo

type UserSearchDTO

type UserSearchDTO struct {
	Top   []string `json:"top"`
	Total int      `json:"total"`
}

type WuKongAddDiggCmd

type WuKongAddDiggCmd struct {
	User  domain.Account
	Owner domain.Account
	Id    string
}

type WuKongAddLikeFromPublicCmd

type WuKongAddLikeFromPublicCmd struct {
	User  domain.Account
	Owner domain.Account
	Id    string
}

type WuKongAddLikeFromTempCmd

type WuKongAddLikeFromTempCmd struct {
	User    domain.Account
	OBSPath string
}

type WuKongAddPublicFromLikeCmd

type WuKongAddPublicFromLikeCmd struct {
	User domain.Account
	Id   string
}

type WuKongAddPublicFromTempCmd

type WuKongAddPublicFromTempCmd = WuKongAddLikeFromTempCmd

type WuKongCancelDiggCmd

type WuKongCancelDiggCmd WuKongAddDiggCmd

type WuKongCmd

type WuKongCmd domain.WuKongPictureMeta

func (*WuKongCmd) Validate

func (cmd *WuKongCmd) Validate() error

type WuKongIsLikeDTO

type WuKongIsLikeDTO struct {
	IsLike bool
	LikeID string
}

type WuKongLikeDTO

type WuKongLikeDTO struct {
	IsPublic bool `json:"is_public"`

	WuKongPictureBaseDTO
}

type WuKongListPublicGlobalCmd

type WuKongListPublicGlobalCmd struct {
	User  domain.Account
	Level domain.WuKongPictureLevel
	WuKongPictureListOption
}

func (*WuKongListPublicGlobalCmd) Validate

func (cmd *WuKongListPublicGlobalCmd) Validate() error

type WuKongPictureBaseDTO

type WuKongPictureBaseDTO struct {
	Id        string `json:"id"`
	Owner     string `json:"owner"` // owner of picture
	Desc      string `json:"desc"`
	Style     string `json:"style"`
	Link      string `json:"link"`
	CreatedAt string `json:"created_at"`
}

type WuKongPictureListOption

type WuKongPictureListOption struct {
	CountPerPage int
	PageNum      int
}

type WuKongPicturesListCmd

type WuKongPicturesListCmd = repository.WuKongPictureListOption

type WuKongPublicDTO

type WuKongPublicDTO struct {
	Avatar    string `json:"avatar"`
	IsLike    bool   `json:"is_like"`
	LikeID    string `json:"like_id"`
	IsDigg    bool   `json:"is_digg"`
	DiggCount int    `json:"digg_count"`

	WuKongPictureBaseDTO
}

type WuKongPublicGlobalDTO

type WuKongPublicGlobalDTO struct {
	Pictures []WuKongPublicDTO `json:"pictures"`
	Total    int               `json:"total"`
}

Jump to

Keyboard shortcuts

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