mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-11-09 02:33:42 +08:00
feat: add support for registing use force use invite code
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"chatplus/core/types"
|
||||
"chatplus/service/mj"
|
||||
"chatplus/utils"
|
||||
"errors"
|
||||
)
|
||||
|
||||
// AI 绘画函数
|
||||
@@ -11,15 +12,21 @@ import (
|
||||
type FuncMidJourney struct {
|
||||
name string
|
||||
service *mj.Service
|
||||
config types.MidJourneyConfig
|
||||
}
|
||||
|
||||
func NewMidJourneyFunc(mjService *mj.Service) FuncMidJourney {
|
||||
func NewMidJourneyFunc(mjService *mj.Service, config types.MidJourneyConfig) FuncMidJourney {
|
||||
return FuncMidJourney{
|
||||
name: "MidJourney AI 绘画",
|
||||
config: config,
|
||||
service: mjService}
|
||||
}
|
||||
|
||||
func (f FuncMidJourney) Invoke(params map[string]interface{}) (string, error) {
|
||||
if !f.config.Enabled {
|
||||
return "", errors.New("MidJourney AI 绘画功能没有启用")
|
||||
}
|
||||
|
||||
logger.Infof("MJ 绘画参数:%+v", params)
|
||||
prompt := utils.InterfaceToString(params["prompt"])
|
||||
f.service.PushTask(types.MjTask{
|
||||
|
||||
@@ -34,6 +34,6 @@ func NewFunctions(config *types.AppConfig, mjService *mj.Service) map[string]Fun
|
||||
types.FuncZaoBao: NewZaoBao(config.ApiConfig),
|
||||
types.FuncWeibo: NewWeiboHot(config.ApiConfig),
|
||||
types.FuncHeadLine: NewHeadLines(config.ApiConfig),
|
||||
types.FuncMidJourney: NewMidJourneyFunc(mjService),
|
||||
types.FuncMidJourney: NewMidJourneyFunc(mjService, config.MjConfig),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user