Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions api/handler/stat.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func NewStatHandler(config *config.Config) (*StatHandler, error) {
// @Produce json
// @Param target_type query string true "Target type"
// @Param date_type query string true "Date type" Enums(year,month,week,day)
// @Success 200 {object} map[string]types.StatSnapshotResp "OK"
// @Success 200 {object} types.Response{data=types.StatSnapshotResp} "OK"
// @Failure 400 {object} types.APIBadRequest "Bad request"
// @Failure 500 {object} types.APIInternalServerError "Internal server error"
// @Router /stat/snapshot [get]
Expand Down Expand Up @@ -76,7 +76,7 @@ func (h *StatHandler) GetStatSnap(ctx *gin.Context) {
// @Tags Stat
// @Accept json
// @Produce json
// @Success 200 {object} map[int]types.StatRunningDeploy "OK"
// @Success 200 {object} types.Response{data=map[int]types.StatRunningDeploy} "OK"
// @Failure 401 {object} types.APIUnauthorized "Unauthorized"
// @Failure 500 {object} types.APIInternalServerError "Internal server error"
// @Router /stat/running-deploys [get]
Expand Down
14 changes: 7 additions & 7 deletions api/handler/tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type TagsHandler struct {
// @Param scope query string false "scope name" Enums(model, dataset, code, space, prompt)
// @Param built_in query bool false "built_in"
// @Param search query string false "search on name and show_name fields"
// @Success 200 {object} types.ResponseWithTotal{data=[]types.RepoTag} "tags"
// @Success 200 {object} types.Response{data=[]types.RepoTag} "tags"
// @Failure 400 {object} types.APIBadRequest "Bad request"
// @Failure 500 {object} types.APIInternalServerError "Internal server error"
// @Router /tags [get]
Expand Down Expand Up @@ -67,7 +67,7 @@ func (t *TagsHandler) AllTags(ctx *gin.Context) {
// @Accept json
// @Produce json
// @Param body body types.CreateTag true "body"
// @Success 200 {object} types.Response{database.Tag} "OK"
// @Success 200 {object} types.Response{data=database.Tag} "OK"
// @Failure 400 {object} types.APIBadRequest "Bad request"
// @Failure 500 {object} types.APIInternalServerError "Internal server error"
// @Router /tags [post]
Expand Down Expand Up @@ -95,7 +95,7 @@ func (t *TagsHandler) CreateTag(ctx *gin.Context) {
// @Accept json
// @Produce json
// @Param id path string true "id of the tag"
// @Success 200 {object} types.Response{database.Tag} "OK"
// @Success 200 {object} types.Response{data=database.Tag} "OK"
// @Failure 400 {object} types.APIBadRequest "Bad request"
// @Failure 500 {object} types.APIInternalServerError "Internal server error"
// @Router /tags/{id} [get]
Expand Down Expand Up @@ -124,7 +124,7 @@ func (t *TagsHandler) GetTagByID(ctx *gin.Context) {
// @Produce json
// @Param id path string true "id of the tag"
// @Param body body types.UpdateTag true "body"
// @Success 200 {object} types.Response{database.Tag} "OK"
// @Success 200 {object} types.Response{data=database.Tag} "OK"
// @Failure 400 {object} types.APIBadRequest "Bad request"
// @Failure 500 {object} types.APIInternalServerError "Internal server error"
// @Router /tags/{id} [put]
Expand Down Expand Up @@ -185,7 +185,7 @@ func (t *TagsHandler) DeleteTag(ctx *gin.Context) {
// @Tags Tag
// @Accept json
// @Produce json
// @Success 200 {object} types.ResponseWithTotal{data=[]types.RepoTagCategory} "categores"
// @Success 200 {object} types.Response{data=[]types.RepoTagCategory} "categores"
// @Failure 400 {object} types.APIBadRequest "Bad request"
// @Failure 500 {object} types.APIInternalServerError "Internal server error"
// @Router /tags/categories [get]
Expand All @@ -207,7 +207,7 @@ func (t *TagsHandler) AllCategories(ctx *gin.Context) {
// @Accept json
// @Produce json
// @Param body body types.CreateCategory true "body"
// @Success 200 {object} types.Response{database.TagCategory} "OK"
// @Success 200 {object} types.Response{data=database.TagCategory} "OK"
// @Failure 400 {object} types.APIBadRequest "Bad request"
// @Failure 500 {object} types.APIInternalServerError "Internal server error"
// @Router /tags/categories [post]
Expand Down Expand Up @@ -239,7 +239,7 @@ func (t *TagsHandler) CreateCategory(ctx *gin.Context) {
// @Accept json
// @Produce json
// @Param body body types.UpdateCategory true "body"
// @Success 200 {object} types.Response{database.TagCategory} "OK"
// @Success 200 {object} types.Response{data=database.TagCategory} "OK"
// @Failure 400 {object} types.APIBadRequest "Bad request"
// @Failure 500 {object} types.APIInternalServerError "Internal server error"
// @Router /tags/categories/id [put]
Expand Down
14 changes: 7 additions & 7 deletions api/handler/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ func (h *UserHandler) UserPermission(ctx *gin.Context) {
// @Param per query int false "per" default(50)
// @Param page query int false "page index" default(1)
// @Param current_user query string false "current user"
// @Success 200 {object} types.Response{} "OK"
// @Success 200 {object} types.ResponseWithTotal{data=[]types.DeployRepo,total=int} "OK"
// @Failure 400 {object} types.APIBadRequest "Bad request"
// @Failure 500 {object} types.APIInternalServerError "Internal server error"
// @Router /user/{username}/run/{repo_type} [get]
Expand Down Expand Up @@ -659,7 +659,7 @@ func (h *UserHandler) GetRunDeploys(ctx *gin.Context) {
// @Param per query int false "per" default(50)
// @Param page query int false "page index" default(1)
// @Param current_user query string false "current user"
// @Success 200 {object} types.Response{} "OK"
// @Success 200 {object} types.ResponseWithTotal{data=[]types.DeployRepo,total=int} "OK"
// @Failure 400 {object} types.APIBadRequest "Bad request"
// @Failure 500 {object} types.APIInternalServerError "Internal server error"
// @Router /user/{username}/finetune/instances [get]
Expand Down Expand Up @@ -702,7 +702,7 @@ func (h *UserHandler) GetFinetuneInstances(ctx *gin.Context) {
// @Param per query int false "per" default(50)
// @Param page query int false "page index" default(1)
// @Param current_user query string false "current user"
// @Success 200 {object} types.Response{} "OK"
// @Success 200 {object} types.ResponseWithTotal{data=[]types.DeployRepo,total=int} "OK"
// @Failure 400 {object} types.APIBadRequest "Bad request"
// @Failure 500 {object} types.APIInternalServerError "Internal server error"
// @Router /user/{username}/run/serverless [get]
Expand Down Expand Up @@ -847,7 +847,7 @@ func (h *UserHandler) GetUserResource(ctx *gin.Context) {
// @Param username path string true "username"
// @Param per query int false "per" default(20)
// @Param page query int false "per page" default(1)
// @Success 200 {object} types.Response{} "OK"
// @Success 200 {object} types.ResponseWithTotal{data=[]types.DeployRepo,total=int} "OK"
// @Failure 400 {object} types.APIBadRequest "Bad request"
// @Failure 500 {object} types.APIInternalServerError "Internal server error"
// @Router /user/{username}/prompts [get]
Expand Down Expand Up @@ -889,7 +889,7 @@ func (h *UserHandler) Prompts(ctx *gin.Context) {
// @Param username path string true "username"
// @Param per query int false "per" default(20)
// @Param page query int false "per page" default(1)
// @Success 200 {object} types.Response{} "OK"
// @Success 200 {object} types.ResponseWithTotal{data=[]types.DeployRepo,total=int} "OK"
// @Failure 400 {object} types.APIBadRequest "Bad request"
// @Failure 500 {object} types.APIInternalServerError "Internal server error"
// @Router /user/{username}/evaluations [get]
Expand Down Expand Up @@ -930,7 +930,7 @@ func (h *UserHandler) GetEvaluations(ctx *gin.Context) {
// @Param username path string true "username"
// @Param per query int false "per" default(20)
// @Param page query int false "per page" default(1)
// @Success 200 {object} types.Response{data=[]types.MCPServer,total=int} "OK"
// @Success 200 {object} types.ResponseWithTotal{data=[]types.MCPServer,total=int} "OK"
// @Failure 400 {object} types.APIBadRequest "Bad request"
// @Failure 500 {object} types.APIInternalServerError "Internal server error"
// @Router /user/{username}/mcps [get]
Expand Down Expand Up @@ -1011,7 +1011,7 @@ func (h *UserHandler) LikesMCPServers(ctx *gin.Context) {
// @Produce json
// @Param page query int false "page number"
// @Param size query int false "page size"
// @Success 200 {array} types.ResponseWithTotal{data=[]types.NotebookRes,total=int} "OK"
// @Success 200 {object} types.ResponseWithTotal{data=[]types.NotebookRes,total=int} "OK"
// @Failure 400 {object} types.APIBadRequest "Bad request"
// @Failure 500 {object} types.APIInternalServerError "Internal server error"
// @Router /user/{username}/notebooks [get]
Expand Down
1 change: 1 addition & 0 deletions common/types/dataset.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type DatasetTagCommit struct {

type CreateDatasetReq struct {
CreateRepoReq
// The type of the dataset
Type int `json:"type"`
}

Expand Down
62 changes: 38 additions & 24 deletions common/types/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,18 @@ type UpdateModelReq struct {
}

type UpdateRepoReq struct {
Username string `json:"-"`
Namespace string `json:"-"`
Name string `json:"-"`
RepoType RepositoryType `json:"-"`
Nickname *string `json:"nickname" example:"model display name"`
Description *string `json:"description"`
Private *bool `json:"private" example:"false"`
// a sign to indicate if the request is from admin
Admin string `json:"-"`
Username string `json:"-"`
Namespace string `json:"-"`
Name string `json:"-"`
// The type of the repository
RepoType RepositoryType `json:"-"`
// The new display name of the repository
Nickname *string `json:"nickname" example:"model display name"`
// The new description for the repository
Description *string `json:"description"`
// The new visibility of the repository
Private *bool `json:"private" example:"false"`
Admin string `json:"-"`
}

// make sure UpdateModelReq implements SensitiveRequest interface
Expand Down Expand Up @@ -87,21 +90,32 @@ type ModelPredictResp struct {
}

type CreateRepoReq struct {
Username string `json:"-" example:"creator_user_name"`
Namespace string `json:"namespace" example:"user_or_org_name"`
Name string `json:"name" example:"model_name_1"`
Nickname string `json:"nickname" example:"model display name"`
Description string `json:"description" binding:"lt=1000"`
Private bool `json:"private"`
Labels string `json:"labels" example:""`
License string `json:"license" example:"MIT" binding:"lt=100"`
Readme string `json:"readme"`
DefaultBranch string `json:"default_branch" example:"main"`
RepoType RepositoryType `json:"type"`
Admin string `json:"admin"`
ToolCount int `json:"tool_count"`
StarCount int `json:"star_count"`
CommitFiles []CommitFile `json:"commit_files"`
Username string `json:"-"`
// The namespace of the repository, which can be a user or an organization
Namespace string `json:"namespace" example:"user_or_org_name"`
// The name of the repository
Name string `json:"name" example:"model_name_1"`
// The display name of the repository
Nickname string `json:"nickname" example:"model display name"`
// A description for the repository
Description string `json:"description" binding:"lt=1000"`
// Whether the repository is private
Private bool `json:"private"`
// The license for the repository
License string `json:"license" example:"MIT" binding:"lt=100"`
Readme string `json:"-"`
// The default branch of the repository
DefaultBranch string `json:"default_branch" example:"main"`
// The type of the repository
RepoType RepositoryType `json:"type"`
// Admin user
Admin string `json:"admin"`
// Tool count
ToolCount int `json:"tool_count"`
// Star count
StarCount int `json:"star_count"`
// Files to commit
CommitFiles []CommitFile `json:"commit_files"`
}

// make sure CreateRepoReq implements SensitiveRequest
Expand Down
Loading