mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-09-18 01:06:39 +08:00
39 lines
899 B
Go
39 lines
899 B
Go
package function
|
|
|
|
import (
|
|
"chatplus/core/types"
|
|
logger2 "chatplus/logger"
|
|
)
|
|
|
|
type Function interface {
|
|
Invoke(map[string]interface{}) (string, error)
|
|
Name() string
|
|
}
|
|
|
|
var logger = logger2.GetLogger()
|
|
|
|
type resVo struct {
|
|
Code types.BizCode `json:"code"`
|
|
Message string `json:"message"`
|
|
Data struct {
|
|
Title string `json:"title"`
|
|
UpdatedAt string `json:"updated_at"`
|
|
Items []dataItem `json:"items"`
|
|
} `json:"data"`
|
|
}
|
|
|
|
type dataItem struct {
|
|
Title string `json:"title"`
|
|
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),
|
|
}
|
|
}
|