feat: add midjouney api implements, optimize function calls

This commit is contained in:
RockYang
2023-08-11 18:46:56 +08:00
parent 0b27890484
commit 302cb8a5be
17 changed files with 298 additions and 183 deletions

View File

@@ -1,12 +1,17 @@
package function
import "chatplus/core/types"
import (
"chatplus/core/types"
logger2 "chatplus/logger"
)
type Function interface {
Invoke(...interface{}) (string, error)
Invoke(map[string]interface{}) (string, error)
Name() string
}
var logger = logger2.GetLogger()
type resVo struct {
Code types.BizCode `json:"code"`
Message string `json:"message"`
@@ -22,3 +27,12 @@ type dataItem struct {
Url string `json:"url"`
Remark string `json:"remark"`
}
func NewFunctions(config *types.AppConfig) map[string]Function {
return map[string]Function{
types.FuncZaoBao: NewZaoBao(config.ApiConfig),
types.FuncWeibo: NewWeiboHot(config.ApiConfig),
types.FuncHeadLine: NewHeadLines(config.ApiConfig),
types.FuncMidJourney: NewMidJourneyFunc(config.ExtConfig),
}
}