upgrade to v4.0.4

This commit is contained in:
RockYang
2024-05-07 16:32:05 +08:00
parent 2f0215ac87
commit 5c4899df6e
96 changed files with 3315 additions and 625 deletions

View File

@@ -35,13 +35,12 @@ func (db *LevelDB) Put(key string, value interface{}) error {
return db.driver.Put([]byte(key), byteData, nil)
}
func (db *LevelDB) Get(key string) ([]byte, error) {
func (db *LevelDB) Get(key string, dist interface{}) error {
bytes, err := db.driver.Get([]byte(key), nil)
if err != nil {
return nil, err
return err
}
return bytes, nil
return json.Unmarshal(bytes, dist)
}
func (db *LevelDB) Search(prefix string) []string {

View File

@@ -12,4 +12,5 @@ type ChatModel struct {
MaxTokens int // 最大响应长度
MaxContext int // 最大上下文长度
Temperature float32 // 模型温度
KeyId int // 绑定 API KEY ID
}

View File

@@ -9,4 +9,5 @@ type ChatRole struct {
Icon string // 角色聊天图标
Enable bool // 是否启用被启用
SortNum int //排序数字
ModelId int // 绑定模型ID绑定模型ID的角色只能用指定的模型来问答
}

View File

@@ -0,0 +1,16 @@
package model
import "time"
type DallJob struct {
Id uint `gorm:"primarykey;column:id"`
UserId uint
Prompt string
ImgURL string
OrgURL string
Publish bool
Power int
Progress int
ErrMsg string
CreatedAt time.Time
}

View File

@@ -12,4 +12,6 @@ type ChatModel struct {
MaxTokens int `json:"max_tokens"` // 最大响应长度
MaxContext int `json:"max_context"` // 最大上下文长度
Temperature float32 `json:"temperature"` // 模型温度
KeyId int `json:"key_id"`
KeyName string `json:"key_name"`
}

View File

@@ -4,11 +4,13 @@ import "chatplus/core/types"
type ChatRole struct {
BaseVo
Key string `json:"key"` // 角色唯一标识
Name string `json:"name"` // 角色名称
Context []types.Message `json:"context"` // 角色语料信息
HelloMsg string `json:"hello_msg"` // 打招呼的消息
Icon string `json:"icon"` // 角色聊天图标
Enable bool `json:"enable"` // 是否启用被启用
SortNum int `json:"sort"` // 排序
Key string `json:"key"` // 角色唯一标识
Name string `json:"name"` // 角色名称
Context []types.Message `json:"context"` // 角色语料信息
HelloMsg string `json:"hello_msg"` // 打招呼的消息
Icon string `json:"icon"` // 角色聊天图标
Enable bool `json:"enable"` // 是否启用被启用
SortNum int `json:"sort"` // 排序
ModelId int `json:"model_id"` // 绑定模型 ID
ModelName string `json:"model_name"` // 模型名称
}

14
api/store/vo/dalle_job.go Normal file
View File

@@ -0,0 +1,14 @@
package vo
type DallJob struct {
Id uint `json:"id"`
UserId int `json:"user_id"`
Prompt string `json:"prompt"`
ImgURL string `json:"img_url"`
OrgURL string `json:"org_url"`
Publish bool `json:"publish"`
Power int `json:"power"`
Progress int `json:"progress"`
ErrMsg string `json:"err_msg"`
CreatedAt int64 `json:"created_at"`
}