mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-11-15 12:43:41 +08:00
🎨 添加工厂方法
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user