feat(release): migrate GeekAI v4.3.0 to open source

- Sync backend and frontend from GeekAI Plus v4.3.0

- Remove commercial License flows and update open-source deployment defaults

- Preserve Docker Compose deployment and bump image tags to v4.3.0

BREAKING CHANGE: commercial License configuration and related endpoints are removed
This commit is contained in:
RockYang
2026-08-11 14:51:20 +08:00
parent 37e024acea
commit 9ccff4efbc
219 changed files with 29212 additions and 10802 deletions
+89 -13
View File
@@ -8,32 +8,41 @@ package oss
// * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
import (
"fmt"
"geekai/core/types"
"strings"
logger2 "geekai/logger"
"geekai/log"
)
var logger = logger2.GetLogger()
var logger = log.GetLogger()
// 默认缩略图模板(本地存储格式)
const DefaultThumbTemplate = "?imageView2/4/w/{width}/h/{height}/q/75"
type UploaderManager struct {
local *LocalStorage
aliyun *AliYunOss
mini *MiniOss
qiniu *QiNiuOss
active string
local *LocalStorage
aliyun *AliYunOss
mini *MiniOss
qiniu *QiNiuOss
tencent *TencentOss
active string
ossConfig types.OSSConfig // 保存当前OSS配置
}
func NewUploaderManager(sysConfig *types.SystemConfig, local *LocalStorage, aliyun *AliYunOss, mini *MiniOss, qiniu *QiNiuOss) (*UploaderManager, error) {
func NewUploaderManager(sysConfig *types.SystemConfig, local *LocalStorage, aliyun *AliYunOss, mini *MiniOss, qiniu *QiNiuOss, tencent *TencentOss) (*UploaderManager, error) {
if sysConfig.OSS.Active == "" {
sysConfig.OSS.Active = Local
}
return &UploaderManager{
active: sysConfig.OSS.Active,
local: local,
aliyun: aliyun,
mini: mini,
qiniu: qiniu,
active: sysConfig.OSS.Active,
local: local,
aliyun: aliyun,
mini: mini,
qiniu: qiniu,
tencent: tencent,
ossConfig: sysConfig.OSS,
}, nil
}
@@ -47,6 +56,8 @@ func (m *UploaderManager) GetUploadHandler() Uploader {
return m.mini
case QiNiu:
return m.qiniu
case Tencent:
return m.tencent
}
return m.local
}
@@ -61,6 +72,71 @@ func (m *UploaderManager) UpdateConfig(config types.OSSConfig) {
m.mini.UpdateConfig(config.Minio)
case QiNiu:
m.qiniu.UpdateConfig(config.QiNiu)
case Tencent:
m.tencent.UpdateConfig(config.Tencent)
}
m.active = config.Active
m.ossConfig = config
}
// GetThumbURL 根据原始图片URL和尺寸生成缩略图URL
// 如果模板为空,使用默认模板(本地存储格式)
// 如果明确设置为空字符串(表示不支持缩略图),返回原图URL
func (m *UploaderManager) GetThumbURL(originalURL string, width, height int) string {
var template string
// 根据当前激活的存储引擎获取对应的模板
switch m.active {
case Local:
template = m.ossConfig.Local.ThumbTemplate
case AliYun:
template = m.ossConfig.AliYun.ThumbTemplate
case Minio:
template = m.ossConfig.Minio.ThumbTemplate
case QiNiu:
template = m.ossConfig.QiNiu.ThumbTemplate
case Tencent:
template = m.ossConfig.Tencent.ThumbTemplate
default:
template = m.ossConfig.Local.ThumbTemplate
}
// 如果模板为空,使用默认模板(兼容旧配置)
if template == "" {
template = DefaultThumbTemplate
}
// 替换变量
thumbURL := strings.ReplaceAll(template, "{width}", fmt.Sprintf("%d", width))
thumbURL = strings.ReplaceAll(thumbURL, "{height}", fmt.Sprintf("%d", height))
// 拼接原始URL和缩略图参数
return originalURL + thumbURL
}
// GetThumbTemplate 获取当前存储引擎的缩略图模板
func (m *UploaderManager) GetThumbTemplate() string {
var template string
switch m.active {
case Local:
template = m.ossConfig.Local.ThumbTemplate
case AliYun:
template = m.ossConfig.AliYun.ThumbTemplate
case Minio:
template = m.ossConfig.Minio.ThumbTemplate
case QiNiu:
template = m.ossConfig.QiNiu.ThumbTemplate
case Tencent:
template = m.ossConfig.Tencent.ThumbTemplate
default:
template = m.ossConfig.Local.ThumbTemplate
}
// 如果模板为空,返回默认模板
if template == "" {
return DefaultThumbTemplate
}
return template
}