|
|
|
@@ -8,6 +8,15 @@ import ( |
|
|
|
routerRepo "code.gitea.io/gitea/routers/repo" |
|
|
|
) |
|
|
|
|
|
|
|
type FileInfo struct { |
|
|
|
FileName string `json:"fileName"` |
|
|
|
ModTime string `json:"modTime"` |
|
|
|
IsDir bool `json:"isDir"` |
|
|
|
Size int64 `json:"size"` |
|
|
|
ParenDir string `json:"parenDir"` |
|
|
|
UUID string `json:"uuid"` |
|
|
|
} |
|
|
|
|
|
|
|
func CreateNewModel(ctx *context.APIContext) { |
|
|
|
log.Info("CreateNewModel by api.") |
|
|
|
routerRepo.SaveModel(ctx.Context) |
|
|
|
@@ -35,7 +44,21 @@ func QueryModelListForPredict(ctx *context.APIContext) { |
|
|
|
|
|
|
|
func QueryModelFileForPredict(ctx *context.APIContext) { |
|
|
|
log.Info("QueryModelFileForPredict by api.") |
|
|
|
routerRepo.QueryModelFileForPredict(ctx.Context) |
|
|
|
id := ctx.Query("id") |
|
|
|
result := routerRepo.QueryModelFileByID(id) |
|
|
|
re := make([]FileInfo, len(result)) |
|
|
|
for _, file := range result { |
|
|
|
tmpFile := FileInfo{ |
|
|
|
FileName: file.FileName, |
|
|
|
ModTime: file.ModTime, |
|
|
|
IsDir: file.IsDir, |
|
|
|
Size: file.Size, |
|
|
|
ParenDir: file.ParenDir, |
|
|
|
UUID: file.UUID, |
|
|
|
} |
|
|
|
re = append(re, tmpFile) |
|
|
|
} |
|
|
|
ctx.JSON(http.StatusOK, re) |
|
|
|
} |
|
|
|
|
|
|
|
func CreateModelConvert(ctx *context.APIContext) { |
|
|
|
|