mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-11-14 20:23:46 +08:00
✨ add: add images api
This commit is contained in:
@@ -23,6 +23,9 @@ type BaseProvider struct {
|
||||
Moderation string
|
||||
AudioTranscriptions string
|
||||
AudioTranslations string
|
||||
ImagesGenerations string
|
||||
ImagesEdit string
|
||||
ImagesVariations string
|
||||
Proxy string
|
||||
Context *gin.Context
|
||||
}
|
||||
@@ -141,6 +144,12 @@ func (p *BaseProvider) SupportAPI(relayMode int) bool {
|
||||
return p.AudioTranslations != ""
|
||||
case common.RelayModeModerations:
|
||||
return p.Moderation != ""
|
||||
case common.RelayModeImagesGenerations:
|
||||
return p.ImagesGenerations != ""
|
||||
case common.RelayModeImagesEdit:
|
||||
return p.ImagesEdit != ""
|
||||
case common.RelayModeImagesVariations:
|
||||
return p.ImagesVariations != ""
|
||||
default:
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -50,11 +50,17 @@ type TranscriptionsInterface interface {
|
||||
TranscriptionsAction(request *types.AudioRequest, isModelMapped bool, promptTokens int) (usage *types.Usage, errWithCode *types.OpenAIErrorWithStatusCode)
|
||||
}
|
||||
|
||||
// 语音翻译接口
|
||||
type TranslationInterface interface {
|
||||
ProviderInterface
|
||||
TranslationAction(request *types.AudioRequest, isModelMapped bool, promptTokens int) (usage *types.Usage, errWithCode *types.OpenAIErrorWithStatusCode)
|
||||
}
|
||||
|
||||
type ImageGenerationsInterface interface {
|
||||
ProviderInterface
|
||||
ImageGenerationsAction(request *types.ImageRequest, isModelMapped bool, promptTokens int) (usage *types.Usage, errWithCode *types.OpenAIErrorWithStatusCode)
|
||||
}
|
||||
|
||||
// 余额接口
|
||||
type BalanceInterface interface {
|
||||
BalanceAction(channel *model.Channel) (float64, error)
|
||||
|
||||
Reference in New Issue
Block a user