This commit is contained in:
2023-04-28 07:09:29 +08:00
parent 1c08718840
commit c2549703f0
4 changed files with 68 additions and 21 deletions

View File

@@ -67,6 +67,47 @@ type Model struct {
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
type Task struct {
ID int `json:"id"`
Name string `json:"name"`
Type string `json:"type"` // 任務類型(訓練|推理)
Status string `json:"status"` // (waiting|running|success|error)
Progress int `json:"progress"` // (0-100)
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
type Image struct {
ID int `json:"id"`
Name string `json:"name"`
Width int `json:"width"`
Height int `json:"height"`
Prompt string `json:"prompt"`
NegativePrompt string `json:"negative_prompt"`
NumInferenceSteps int `json:"num_inference_steps"` // Number of inference steps (minimum: 1; maximum: 500)
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)
Seed int `json:"seed"` // Random seed (minimum: 0; maximum: 2147483647)
FromImage string `json:"from_image"` // Image to start from
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
type Tag struct {
ID int `json:"id"`
Name string `json:"name"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
type User struct {
ID int `json:"id"`
Name string `json:"name"`
Email string `json:"email"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
```
```javascript
//// TODO
@@ -132,22 +173,6 @@ type Model struct {
createdAt: '', // 創建時間
updatedAt: '', // 更新時間
}
// User 用戶對象
{
id: 'xxxxx', // 用戶ID
name: 'xxx', // 用戶名稱
createdAt: '', // 創建時間
updatedAt: '', // 更新時間
}
// Tag 標籤對象
{
id: 'xxxxx', // 標籤ID
name: 'xxx', // 標籤名稱
createdAt: '', // 創建時間
updatedAt: '', // 更新時間
}
```
---------------------------------------------------------------

View File

@@ -30,6 +30,15 @@ func init() {
CREATE TABLE IF NOT EXISTS images(
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT,
width INTEGER,
height INTEGER,
prompt TEXT,
negative_prompt TEXT,
num_inference_steps INTEGER,
guidance_scale REAL,
scheduler TEXT,
seed INTEGER,
from_image TEXT,
created_at TEXT,
updated_at TEXT
);
@@ -62,6 +71,8 @@ func init() {
CREATE TABLE IF NOT EXISTS tasks(
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT,
status TEXT,
progress INTEGER,
created_at TEXT,
updated_at TEXT
);

View File

@@ -6,10 +6,19 @@ import (
)
type Image struct {
ID int `json:"id"`
Name string `json:"name"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
ID int `json:"id"`
Name string `json:"name"`
Width int `json:"width"`
Height int `json:"height"`
Prompt string `json:"prompt"`
NegativePrompt string `json:"negative_prompt"`
NumInferenceSteps int `json:"num_inference_steps"` // Number of inference steps (minimum: 1; maximum: 500)
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)
Seed int `json:"seed"` // Random seed (minimum: 0; maximum: 2147483647)
FromImage string `json:"from_image"` // Image to start from
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
func (image *Image) Create() error {

View File

@@ -8,7 +8,9 @@ import (
type Task struct {
ID int `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
Type string `json:"type"` // 任務類型(訓練|推理)
Status string `json:"status"` // (waiting|running|success|error)
Progress int `json:"progress"` // (0-100)
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}