mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-11-14 20:23:46 +08:00
🎨 添加工厂方法
This commit is contained in:
@@ -1,18 +1,20 @@
|
||||
package aiproxy
|
||||
|
||||
import (
|
||||
"one-api/providers/base"
|
||||
"one-api/providers/openai"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type AIProxyProvider struct {
|
||||
*openai.OpenAIProvider
|
||||
}
|
||||
type AIProxyProviderFactory struct{}
|
||||
|
||||
// 创建 CreateAIProxyProvider
|
||||
func CreateAIProxyProvider(c *gin.Context) *AIProxyProvider {
|
||||
func (f AIProxyProviderFactory) Create(c *gin.Context) base.ProviderInterface {
|
||||
return &AIProxyProvider{
|
||||
OpenAIProvider: openai.CreateOpenAIProvider(c, "https://api.aiproxy.io"),
|
||||
}
|
||||
}
|
||||
|
||||
type AIProxyProvider struct {
|
||||
*openai.OpenAIProvider
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user