更新文檔
This commit is contained in:
134
README.md
134
README.md
@@ -4,12 +4,14 @@
|
|||||||
|
|
||||||
```go
|
```go
|
||||||
type User struct {
|
type User struct {
|
||||||
ID int `json:"id"`
|
ID int `json:"id" gorm:"primary_key"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Email string `json:"email"`
|
Email string `json:"email" gorm:"unique;not null"`
|
||||||
Password string `json:"password"`
|
Password string `json:"-"`
|
||||||
CreatedAt string `json:"created_at"`
|
Slat string `json:"-"`
|
||||||
UpdatedAt string `json:"updated_at"`
|
Admin bool `json:"admin"`
|
||||||
|
CreatedAt time.Time `json:"created_at" gorm:"autoCreateTime"`
|
||||||
|
UpdatedAt time.Time `json:"updated_at" gorm:"autoUpdateTime"`
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -24,8 +26,12 @@ type User struct {
|
|||||||
|
|
||||||
```go
|
```go
|
||||||
type Session struct {
|
type Session struct {
|
||||||
ID string `json:"ID"`
|
ID string `json:"id" gorm:"primary_key"`
|
||||||
UserID int `json:"user_id"`
|
IP string `json:"ip"`
|
||||||
|
UserID int `json:"user_id"`
|
||||||
|
UserAgent string `json:"user_agent"`
|
||||||
|
CreatedAt time.Time `json:"created_at" gorm:"autoCreateTime"`
|
||||||
|
UpdatedAt time.Time `json:"updated_at" gorm:"autoUpdateTime"`
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -40,8 +46,16 @@ type Session struct {
|
|||||||
|
|
||||||
```go
|
```go
|
||||||
type Dataset struct {
|
type Dataset struct {
|
||||||
Images []string `json:"images"`
|
ID int `json:"id" gorm:"primary_key"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Info string `json:"info"`
|
||||||
|
Images ImageList `json:"images"`
|
||||||
|
UserID int `json:"user_id"`
|
||||||
|
CreatedAt time.Time `json:"created_at" gorm:"autoCreateTime"`
|
||||||
|
UpdatedAt time.Time `json:"updated_at" gorm:"autoUpdateTime"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ImageList []string // image URL
|
||||||
```
|
```
|
||||||
|
|
||||||
- [x] GET [/api/datasets](/api/datasets) 數據集列表
|
- [x] GET [/api/datasets](/api/datasets) 數據集列表
|
||||||
@@ -55,10 +69,10 @@ type Dataset struct {
|
|||||||
|
|
||||||
```go
|
```go
|
||||||
type Tag struct {
|
type Tag struct {
|
||||||
ID int `json:"id"`
|
ID int `json:"id" gorm:"primary_key"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
CreatedAt string `json:"created_at"`
|
CreatedAt time.Time `json:"created_at" gorm:"autoCreateTime"`
|
||||||
UpdatedAt string `json:"updated_at"`
|
UpdatedAt time.Time `json:"updated_at" gorm:"autoUpdateTime"`
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -73,19 +87,23 @@ type Tag struct {
|
|||||||
|
|
||||||
```go
|
```go
|
||||||
type Model struct {
|
type Model struct {
|
||||||
ID int `json:"id"`
|
ID int `json:"id" gorm:"primary_key"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Type string `json:"type"` // (lora|ckp|hyper|ti)
|
Type string `json:"type"` // (lora|ckp|hyper|ti)
|
||||||
TriggerWords string `json:"trigger_words"` // 觸發詞
|
TriggerWords string `json:"trigger_words"` // 觸發詞
|
||||||
BaseModel string `json:"base_model"` // (SD1.5|SD2)
|
BaseModel string `json:"base_model"` // (SD1.5|SD2)
|
||||||
ModelPath string `json:"model_path"` // 模型路徑
|
ModelPath string `json:"model_path"` // 模型路徑
|
||||||
Status string `json:"status"` // (initial|ready|waiting|running|success|error)
|
Status string `json:"status" default:"initial"` // (initial|ready|waiting|running|success|error)
|
||||||
Progress int `json:"progress"` // (0-100)
|
Progress int `json:"progress"` // (0-100)
|
||||||
Image string `json:"image"` // 封面圖片實際地址
|
Image string `json:"image"` // 封面圖片實際地址
|
||||||
Tags string `json:"tags"`
|
Hash string `json:"hash"` // 模型哈希值
|
||||||
CreatedAt string `json:"created_at"`
|
Epochs int `json:"epochs"` // 訓練步數
|
||||||
UpdatedAt string `json:"updated_at"`
|
Tags TagList `json:"tags"`
|
||||||
UserID int `json:"user_id"`
|
UserID int `json:"user_id"`
|
||||||
|
DatasetID int `json:"dataset_id"`
|
||||||
|
ServerID int `json:"server_id"`
|
||||||
|
CreatedAt time.Time `json:"created_at" gorm:"autoCreateTime"`
|
||||||
|
UpdatedAt time.Time `json:"updated_at" gorm:"autoUpdateTime"`
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -103,20 +121,20 @@ type Model struct {
|
|||||||
|
|
||||||
```go
|
```go
|
||||||
type Image struct {
|
type Image struct {
|
||||||
ID int `json:"id"`
|
ID int `json:"id" gorm:"primary_key"`
|
||||||
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"` // (1~500)
|
NumInferenceSteps int `json:"num_inference_steps"` // Number of inference steps (minimum: 1; maximum: 500)
|
||||||
GuidanceScale float32 `json:"guidance_scale"` // (1~20)
|
GuidanceScale float32 `json:"guidance_scale"` // Scale for classifier-free guidance (minimum: 1; maximum: 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"` // 隨機數種子
|
Seed int `json:"seed"` // Random seed (minimum: 0; maximum: 2147483647)
|
||||||
FromImage string `json:"from_image"` // 圖片地址(以圖繪圖)
|
FromImage string `json:"from_image"` // Image to start from
|
||||||
CreatedAt string `json:"created_at"`
|
UserID int `json:"user_id"`
|
||||||
UpdatedAt string `json:"updated_at"`
|
CreatedAt time.Time `json:"created_at" gorm:"autoCreateTime"`
|
||||||
UserID int `json:"user_id"`
|
UpdatedAt time.Time `json:"updated_at" gorm:"autoUpdateTime"`
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -129,14 +147,14 @@ type Image struct {
|
|||||||
|
|
||||||
```go
|
```go
|
||||||
type Task struct {
|
type Task struct {
|
||||||
ID int `json:"id"`
|
ID int `json:"id" gorm:"primary_key"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Type string `json:"type"` // 任務類型(訓練|推理)
|
Type string `json:"type"` // 任務類型(訓練|推理)
|
||||||
Status string `json:"status"` // 任務狀態(initial|ready|waiting|running|success|error)
|
Status string `json:"status"` // (initial|ready|waiting|running|success|error)
|
||||||
Progress int `json:"progress"` // 任務進度(0-100)
|
Progress int `json:"progress"` // (0-100)
|
||||||
CreatedAt string `json:"created_at"`
|
UserID int `json:"user_id"`
|
||||||
UpdatedAt string `json:"updated_at"`
|
CreatedAt time.Time `json:"created_at" gorm:"autoCreateTime"`
|
||||||
UserID int `json:"user_id"`
|
UpdatedAt time.Time `json:"updated_at" gorm:"autoUpdateTime"`
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -161,7 +179,13 @@ type Param struct {
|
|||||||
|
|
||||||
```go
|
```go
|
||||||
type Account struct {
|
type Account struct {
|
||||||
// 同 user
|
ID int `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Email string `json:"email"`
|
||||||
|
Admin bool `json:"admin"`
|
||||||
|
SessionID string `json:"session_id"`
|
||||||
|
CreatedAt time.Time `json:"created_at"`
|
||||||
|
UpdatedAt time.Time `json:"updated_at"`
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -173,7 +197,17 @@ type Account struct {
|
|||||||
|
|
||||||
```go
|
```go
|
||||||
type Server struct {
|
type Server struct {
|
||||||
IP string `json:"ip"`
|
ID int `json:"id" gorm:"primary_key"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Type string `json:"type"` // (訓練|推理)
|
||||||
|
IP string `json:"ip"`
|
||||||
|
Port int `json:"port"`
|
||||||
|
Status string `json:"status"` // (異常|初始化|閒置|就緒|工作中|關閉中)
|
||||||
|
UserName string `json:"username"`
|
||||||
|
Password string `json:"password"`
|
||||||
|
Models []map[string]interface{} `json:"models" gorm:"-"` // 數據庫不必保存
|
||||||
|
CreatedAt time.Time `json:"created_at" gorm:"autoCreateTime"`
|
||||||
|
UpdatedAt time.Time `json:"updated_at" gorm:"autoUpdateTime"`
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user