mirror of
https://github.com/songquanpeng/one-api.git
synced 2026-01-01 12:35:58 +08:00
🎨 添加工厂方法
This commit is contained in:
@@ -1,18 +1,21 @@
|
||||
package closeai
|
||||
|
||||
import (
|
||||
"one-api/providers/base"
|
||||
"one-api/providers/openai"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type CloseaiProxyProvider struct {
|
||||
*openai.OpenAIProvider
|
||||
}
|
||||
type CloseaiProviderFactory struct{}
|
||||
|
||||
// 创建 CloseaiProxyProvider
|
||||
func CreateCloseaiProxyProvider(c *gin.Context) *CloseaiProxyProvider {
|
||||
// 创建 CloseaiProvider
|
||||
func (f CloseaiProviderFactory) Create(c *gin.Context) base.ProviderInterface {
|
||||
return &CloseaiProxyProvider{
|
||||
OpenAIProvider: openai.CreateOpenAIProvider(c, "https://api.closeai-proxy.xyz"),
|
||||
}
|
||||
}
|
||||
|
||||
type CloseaiProxyProvider struct {
|
||||
*openai.OpenAIProvider
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user