mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-11-08 10:13:44 +08:00
refactor: 重构项目,为所有的 AI 工具都引入算力,采用算力统一结算各个工具的调用次数和权限
This commit is contained in:
@@ -7,6 +7,6 @@ type ChatModel struct {
|
||||
Value string // API Key 的值
|
||||
SortNum int
|
||||
Enabled bool
|
||||
Weight int // 对话权重,每次对话扣减多少次对话额度
|
||||
Power int // 每次对话消耗算力
|
||||
Open bool // 是否开放模型给所有人使用
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ type MidJourneyJob struct {
|
||||
UseProxy bool // 是否使用反代加载图片
|
||||
Publish bool //是否发布图片到画廊
|
||||
ErrMsg string // 报错信息
|
||||
Power int // 消耗算力
|
||||
CreatedAt time.Time
|
||||
}
|
||||
|
||||
|
||||
20
api/store/model/power_log.go
Normal file
20
api/store/model/power_log.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"chatplus/core/types"
|
||||
"time"
|
||||
)
|
||||
|
||||
// PowerLog 算力消费日志
|
||||
type PowerLog struct {
|
||||
Id uint `gorm:"primarykey;column:id"`
|
||||
UserId uint
|
||||
Username string
|
||||
Type types.PowerType
|
||||
Amount int
|
||||
Balance int
|
||||
Model string // 模型
|
||||
Remark string // 备注
|
||||
Mark types.PowerMark // 资金类型
|
||||
CreatedAt time.Time
|
||||
}
|
||||
@@ -7,8 +7,7 @@ type Product struct {
|
||||
Price float64
|
||||
Discount float64
|
||||
Days int
|
||||
Calls int
|
||||
ImgCalls int
|
||||
Power int
|
||||
Enabled bool
|
||||
Sales int
|
||||
SortNum int
|
||||
|
||||
@@ -13,6 +13,7 @@ type SdJob struct {
|
||||
Params string
|
||||
Publish bool //是否发布图片到画廊
|
||||
ErrMsg string // 报错信息
|
||||
Power int // 消耗算力
|
||||
CreatedAt time.Time
|
||||
}
|
||||
|
||||
|
||||
@@ -7,9 +7,7 @@ type User struct {
|
||||
Password string
|
||||
Avatar string
|
||||
Salt string // 密码盐
|
||||
TotalTokens int64 // 总消耗 tokens
|
||||
Calls int // 剩余对话次数
|
||||
ImgCalls int // 剩余绘图次数
|
||||
Power int // 剩余算力
|
||||
ChatConfig string `gorm:"column:chat_config_json"` // 聊天配置 json
|
||||
ChatRoles string `gorm:"column:chat_roles_json"` // 聊天角色
|
||||
ChatModels string `gorm:"column:chat_models_json"` // AI 模型,不同的用户拥有不同的聊天模型
|
||||
@@ -18,5 +16,4 @@ type User struct {
|
||||
LastLoginAt int64 // 最后登录时间
|
||||
LastLoginIp string // 最后登录 IP
|
||||
Vip bool // 是否 VIP 会员
|
||||
Tokens int
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user