mirror of
https://github.com/yangjian102621/geekai.git
synced 2026-04-24 03:54:26 +08:00
3D生成服务已经完成
This commit is contained in:
@@ -157,6 +157,24 @@ func LoadSystemConfig(db *gorm.DB) *types.SystemConfig {
|
||||
logger.Error("load moderation config error: ", err)
|
||||
}
|
||||
|
||||
// 加载即梦AI配置
|
||||
var jimengConfig types.JimengConfig
|
||||
sysConfig.Id = 0
|
||||
db.Where("name", types.ConfigKeyJimeng).First(&sysConfig)
|
||||
err = utils.JsonDecode(sysConfig.Value, &jimengConfig)
|
||||
if err != nil {
|
||||
logger.Error("load jimeng config error: ", err)
|
||||
}
|
||||
|
||||
// 加载3D生成配置
|
||||
var ai3dConfig types.AI3DConfig
|
||||
sysConfig.Id = 0
|
||||
db.Where("name", types.ConfigKeyAI3D).First(&sysConfig)
|
||||
err = utils.JsonDecode(sysConfig.Value, &ai3dConfig)
|
||||
if err != nil {
|
||||
logger.Error("load ai3d config error: ", err)
|
||||
}
|
||||
|
||||
return &types.SystemConfig{
|
||||
Base: baseConfig,
|
||||
License: license,
|
||||
@@ -167,5 +185,7 @@ func LoadSystemConfig(db *gorm.DB) *types.SystemConfig {
|
||||
Captcha: captchaConfig,
|
||||
WxLogin: wxLoginConfig,
|
||||
Moderation: moderationConfig,
|
||||
Jimeng: jimengConfig,
|
||||
AI3D: ai3dConfig,
|
||||
}
|
||||
}
|
||||
|
||||
58
api/core/types/ai3d.go
Normal file
58
api/core/types/ai3d.go
Normal file
@@ -0,0 +1,58 @@
|
||||
package types
|
||||
|
||||
// AI3DConfig 3D生成配置
|
||||
type AI3DConfig struct {
|
||||
Tencent Tencent3DConfig `json:"tencent,omitempty"`
|
||||
Gitee Gitee3DConfig `json:"gitee,omitempty"`
|
||||
}
|
||||
|
||||
// Tencent3DConfig 腾讯云3D配置
|
||||
type Tencent3DConfig struct {
|
||||
SecretId string `json:"secret_id,omitempty"`
|
||||
SecretKey string `json:"secret_key,omitempty"`
|
||||
Region string `json:"region,omitempty"`
|
||||
Enabled bool `json:"enabled,omitempty"`
|
||||
Models []AI3DModel `json:"models,omitempty"`
|
||||
}
|
||||
|
||||
// Gitee3DConfig Gitee 3D配置
|
||||
type Gitee3DConfig struct {
|
||||
APIKey string `json:"api_key,omitempty"`
|
||||
Enabled bool `json:"enabled,omitempty"`
|
||||
Models []AI3DModel `json:"models,omitempty"`
|
||||
}
|
||||
|
||||
// AI3DJobResult 3D任务结果
|
||||
type AI3DJobResult struct {
|
||||
JobId string `json:"job_id"` // 任务ID
|
||||
Status string `json:"status"` // 任务状态
|
||||
Progress int `json:"progress"` // 任务进度 (0-100)
|
||||
FileURL string `json:"file_url"` // 3D模型文件URL
|
||||
PreviewURL string `json:"preview_url"` // 预览图片URL
|
||||
ErrorMsg string `json:"error_msg"` // 错误信息
|
||||
}
|
||||
|
||||
// AI3DModel 3D模型配置
|
||||
type AI3DModel struct {
|
||||
Name string `json:"name"` // 模型名称
|
||||
Desc string `json:"desc"` // 模型描述
|
||||
Power int `json:"power"` // 算力消耗
|
||||
Formats []string `json:"formats"` // 支持输出的文件格式
|
||||
}
|
||||
|
||||
// AI3DJobRequest 3D任务请求
|
||||
type AI3DJobRequest struct {
|
||||
Type string `json:"type"` // API类型 (tencent/gitee)
|
||||
Model string `json:"model"` // 3D模型类型
|
||||
Prompt string `json:"prompt"` // 文本提示词
|
||||
ImageURL string `json:"image_url"` // 输入图片URL
|
||||
Power int `json:"power"` // 消耗算力
|
||||
}
|
||||
|
||||
// AI3DJobStatus 3D任务状态
|
||||
const (
|
||||
AI3DJobStatusPending = "pending" // 等待中
|
||||
AI3DJobStatusProcessing = "processing" // 处理中
|
||||
AI3DJobStatusCompleted = "completed" // 已完成
|
||||
AI3DJobStatusFailed = "failed" // 失败
|
||||
)
|
||||
@@ -108,6 +108,7 @@ type SystemConfig struct {
|
||||
Captcha CaptchaConfig
|
||||
WxLogin WxLoginConfig
|
||||
Jimeng JimengConfig
|
||||
AI3D AI3DConfig
|
||||
License License
|
||||
Moderation ModerationConfig
|
||||
}
|
||||
@@ -127,4 +128,6 @@ const (
|
||||
ConfigKeyOss = "oss"
|
||||
ConfigKeyPayment = "payment"
|
||||
ConfigKeyModeration = "moderation"
|
||||
ConfigKeyAI3D = "ai3d"
|
||||
ConfigKeyJimeng = "jimeng"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user