This commit is contained in:
2023-04-28 09:04:53 +08:00
parent b6eb9dc112
commit d911d7eb87
2 changed files with 18 additions and 41 deletions

View File

@@ -47,12 +47,11 @@ WS | /api/{name}/{item_id} | Websocket 連接對象
對象模型: 對象模型:
```go ```go
type ListView struct { type ListView struct {
Code int `json:"code"` Page int `json:"page"` // 当前页码
Page int `json:"page"` PageSize int `json:"page_size"` // 分頁大小
PageSize int `json:"page_size"` Total int `json:"total"` // 數據總量
Total int `json:"total"` Next bool `json:"next"` // 可否翻頁
Next bool `json:"next"` List []interface{} `json:"list"` // 數據列表
List []interface{} `json:"list"`
} }
type Model struct { type Model struct {
@@ -74,8 +73,8 @@ type Task struct {
ID int `json:"id"` ID int `json:"id"`
Name string `json:"name"` Name string `json:"name"`
Type string `json:"type"` // 任務類型(訓練|推理) Type string `json:"type"` // 任務類型(訓練|推理)
Status string `json:"status"` // (waiting|running|success|error) Status string `json:"status"` // 任務狀態(waiting|running|success|error)
Progress int `json:"progress"` // (0-100) Progress int `json:"progress"` // 任務進度(0-100)
CreatedAt string `json:"created_at"` CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"` UpdatedAt string `json:"updated_at"`
UserID int `json:"user_id"` UserID int `json:"user_id"`
@@ -86,13 +85,13 @@ type Image struct {
Name string `json:"name"` Name string `json:"name"`
Width int `json:"width"` Width int `json:"width"`
Height int `json:"height"` Height int `json:"height"`
Prompt string `json:"prompt"` Prompt string `json:"prompt"` // 描述詞
NegativePrompt string `json:"negative_prompt"` NegativePrompt string `json:"negative_prompt"` // 排除描述詞
NumInferenceSteps int `json:"num_inference_steps"` // Number of inference steps (minimum: 1; maximum: 500) NumInferenceSteps int `json:"num_inference_steps"` // (1~500)
GuidanceScale float32 `json:"guidance_scale"` // Scale for classifier-free guidance (minimum: 1; maximum: 20) GuidanceScale float32 `json:"guidance_scale"` // (1~20)
Scheduler string `json:"scheduler"` // (DDIM|K_EULER|DPMSolverMultistep|K_EULER_ANCESTRAL|PNDM|KLMS) Scheduler string `json:"scheduler"` // (DDIM|K_EULER|DPMSolverMultistep|K_EULER_ANCESTRAL|PNDM|KLMS)
Seed int `json:"seed"` // Random seed (minimum: 0; maximum: 2147483647) Seed int `json:"seed"` // 隨機數種子
FromImage string `json:"from_image"` // Image to start from FromImage string `json:"from_image"` // 圖片地址(以圖繪圖)
CreatedAt string `json:"created_at"` CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"` UpdatedAt string `json:"updated_at"`
UserID int `json:"user_id"` UserID int `json:"user_id"`
@@ -114,37 +113,16 @@ type User struct {
} }
type Param struct { type Param struct {
// 字段不固定
} }
``` ```
```javascript ```javascript
//// TODO
////训练专属模型模块
////创建模型=>前端对图片列表进行编辑=>获取右侧操作栏数据=>开始训练接=>我的数据集(模型列表)
////  創建模型
////      POST    /api/models
//        type:缺少创建模型的类型枚举
////    上传图片
////        缺少oss接口文档
////  训练模型
//        获取右侧操作栏数据(缺少接口)
////  开始训练接口websocket
////      会根据任务id一直返回进度=>(缺少接口)
////  我的数据集列表
////      缺少小图标统计描述,缺少任务id
////      GET     /api/models
////    模型详情
////        GET     /api/models/12345
////        缺少任务id和模型进度
////  工作状态列表接口
//        - 需要补充字段描述
////      GET /api/tasks
// ListView 列表分頁 // ListView 列表分頁
{ {
page: 1, // 当前页码 page: 1,
pageSize: 20, // 分页数 pageSize: 20,
next: true, // 是否存在下一页 next: true,
list: [] // 列表數據 list: []
} }
// Image 圖片對象 // Image 圖片對象

View File

@@ -6,7 +6,6 @@ import (
) )
type ListView struct { type ListView struct {
Code int `json:"code"`
Page int `json:"page"` Page int `json:"page"`
PageSize int `json:"page_size"` PageSize int `json:"page_size"`
Total int `json:"total"` Total int `json:"total"`