2023-11-29 08:07:09 +00:00
|
|
|
package azure
|
|
|
|
|
|
|
|
import (
|
|
|
|
"one-api/providers/base"
|
|
|
|
"one-api/providers/openai"
|
|
|
|
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
)
|
|
|
|
|
2023-12-02 10:14:48 +00:00
|
|
|
type AzureProviderFactory struct{}
|
2023-11-29 08:07:09 +00:00
|
|
|
|
2023-12-02 10:14:48 +00:00
|
|
|
// 创建 AzureProvider
|
|
|
|
func (f AzureProviderFactory) Create(c *gin.Context) base.ProviderInterface {
|
2023-11-29 08:07:09 +00:00
|
|
|
return &AzureProvider{
|
|
|
|
OpenAIProvider: openai.OpenAIProvider{
|
|
|
|
BaseProvider: base.BaseProvider{
|
|
|
|
BaseURL: "",
|
|
|
|
Completions: "/completions",
|
|
|
|
ChatCompletions: "/chat/completions",
|
|
|
|
Embeddings: "/embeddings",
|
|
|
|
AudioTranscriptions: "/audio/transcriptions",
|
|
|
|
AudioTranslations: "/audio/translations",
|
2023-12-01 09:20:22 +00:00
|
|
|
ImagesGenerations: "/images/generations",
|
|
|
|
// ImagesEdit: "/images/edit",
|
|
|
|
// ImagesVariations: "/images/variations",
|
|
|
|
Context: c,
|
|
|
|
// AudioSpeech: "/audio/speech",
|
2023-11-29 08:07:09 +00:00
|
|
|
},
|
|
|
|
IsAzure: true,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
2023-12-02 10:14:48 +00:00
|
|
|
|
|
|
|
type AzureProvider struct {
|
|
|
|
openai.OpenAIProvider
|
|
|
|
}
|