🎨 添加工厂方法

This commit is contained in:
MartialBE
2023-12-02 18:14:48 +08:00
parent 5e08cc8719
commit da87fca2a2
14 changed files with 125 additions and 84 deletions

View File

@@ -14,15 +14,10 @@ import (
"github.com/gin-gonic/gin"
)
// https://www.xfyun.cn/doc/spark/Web.html
type XunfeiProvider struct {
base.BaseProvider
domain string
apiId string
}
type XunfeiProviderFactory struct{}
// 创建 XunfeiProvider
func CreateXunfeiProvider(c *gin.Context) *XunfeiProvider {
func (f XunfeiProviderFactory) Create(c *gin.Context) base.ProviderInterface {
return &XunfeiProvider{
BaseProvider: base.BaseProvider{
BaseURL: "wss://spark-api.xf-yun.com",
@@ -32,6 +27,13 @@ func CreateXunfeiProvider(c *gin.Context) *XunfeiProvider {
}
}
// https://www.xfyun.cn/doc/spark/Web.html
type XunfeiProvider struct {
base.BaseProvider
domain string
apiId string
}
// 获取请求头
func (p *XunfeiProvider) GetRequestHeaders() (headers map[string]string) {
headers = make(map[string]string)