Documentation ¶
Index ¶
- Variables
- func CalculatePromptToken(inputs ...string) (promptToken int64)
- func CheckAllowIP(_ context.Context, ip string, allowIPs []string) bool
- func CheckApiKeyAvailable(ctx context.Context, key string) (exist bool, allowIPs string, err error)
- func CheckManagementKey[req any, res any](ctx http.Context[req, *http.BaseResponse[res]])
- func CheckManagementKeyAvailable(_ context.Context, key string) bool
- func GetAvailableClient(ctx context.Context, key string, modelName string, promptToken int64, ...) (client openai.Client, metadata *dto.AvailableClientDTO, err error)
- type CompatibleService
- func (srv *CompatibleService) ChatComplete(...)
- func (srv *CompatibleService) CreateSpeech(...)
- func (srv *CompatibleService) CreateSpeechAuthorize(...)
- func (srv *CompatibleService) Embedding(ctx http.Context[*openai.EmbeddingRequestBody, *openai.EmbeddingResponseBody])
- func (srv *CompatibleService) EmbeddingAuthorize(ctx http.Context[*openai.EmbeddingRequestBody, *openai.EmbeddingResponseBody])
- func (srv *CompatibleService) ListModel(ctx http.Context[*openai.ListModelRequest, *openai.ListModelResponseBody])
- func (srv *CompatibleService) ListModelAuthorize(ctx http.Context[*openai.ListModelRequest, *openai.ListModelResponseBody])
- type ManagementService
- func (srv *ManagementService) AuthorizeManagementKey(ctx http.Context[http.NoBody, http.NoResponse])
- func (srv *ManagementService) BatchModifyWhisperUserBalance(...)
- func (srv *ManagementService) CreateClient(ctx http.Context[*entity.CreateClientRequest, *entity.CreateClientResponse])
- func (srv *ManagementService) CreateClientModels(...)
- func (srv *ManagementService) CreateWhisperUser(...)
- func (srv *ManagementService) GetWhisperUser(...)
- func (srv *ManagementService) ListAllClients(ctx http.Context[*entity.ListClientsRequest, *entity.ListClientResponse])
- func (srv *ManagementService) ListClientModels(...)
- func (srv *ManagementService) ListWhisperUserBalanceLogs(...)
- func (srv *ManagementService) ListWhisperUsers(...)
- func (srv *ManagementService) ModifyClientBalance(...)
- func (srv *ManagementService) ModifyWhisperUserBalance(...)
- func (srv *ManagementService) ModifyWhisperUserPermissions(...)
- func (srv *ManagementService) Overview(ctx http.Context[*entity.OverviewRequest, *entity.OverviewResponse])
- func (srv *ManagementService) PreCheckCookie(ctx *gin.Context)
- func (srv *ManagementService) UpdateWhisperUser(...)
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrorNoAvailableClient = errors.New("no available client")
Functions ¶
func CalculatePromptToken ¶
func CheckApiKeyAvailable ¶
func CheckManagementKey ¶
Types ¶
type CompatibleService ¶
type CompatibleService struct{}
func NewCompatibleService ¶
func NewCompatibleService() *CompatibleService
func (*CompatibleService) ChatComplete ¶
func (srv *CompatibleService) ChatComplete(ctx http.Context[*openai.CompleteChatRequestBody, *openai.CompleteChatResponseBody])
func (*CompatibleService) CreateSpeech ¶
func (srv *CompatibleService) CreateSpeech(ctx http.Context[*openai.CreateSpeechRequestBody, *openai.CreateSpeechResponseBody])
func (*CompatibleService) CreateSpeechAuthorize ¶
func (srv *CompatibleService) CreateSpeechAuthorize(ctx http.Context[*openai.CreateSpeechRequestBody, *openai.CreateSpeechResponseBody])
func (*CompatibleService) Embedding ¶
func (srv *CompatibleService) Embedding(ctx http.Context[*openai.EmbeddingRequestBody, *openai.EmbeddingResponseBody])
func (*CompatibleService) EmbeddingAuthorize ¶
func (srv *CompatibleService) EmbeddingAuthorize(ctx http.Context[*openai.EmbeddingRequestBody, *openai.EmbeddingResponseBody])
func (*CompatibleService) ListModel ¶
func (srv *CompatibleService) ListModel(ctx http.Context[*openai.ListModelRequest, *openai.ListModelResponseBody])
func (*CompatibleService) ListModelAuthorize ¶
func (srv *CompatibleService) ListModelAuthorize(ctx http.Context[*openai.ListModelRequest, *openai.ListModelResponseBody])
type ManagementService ¶
type ManagementService struct{}
func NewManagementService ¶
func NewManagementService() *ManagementService
func (*ManagementService) AuthorizeManagementKey ¶
func (srv *ManagementService) AuthorizeManagementKey(ctx http.Context[http.NoBody, http.NoResponse])
func (*ManagementService) BatchModifyWhisperUserBalance ¶
func (srv *ManagementService) BatchModifyWhisperUserBalance(ctx http.Context[*entity.BatchModifyWhisperUserBalanceRequest, *entity.BatchModifyWhisperUserBalanceResponse])
func (*ManagementService) CreateClient ¶
func (srv *ManagementService) CreateClient(ctx http.Context[*entity.CreateClientRequest, *entity.CreateClientResponse])
func (*ManagementService) CreateClientModels ¶
func (srv *ManagementService) CreateClientModels(ctx http.Context[*entity.CreateClientModelRequest, *entity.CreateClientModelResponse])
func (*ManagementService) CreateWhisperUser ¶
func (srv *ManagementService) CreateWhisperUser(ctx http.Context[*entity.CreateWhisperUserRequest, *entity.CreateWhisperUserResponse])
func (*ManagementService) GetWhisperUser ¶
func (srv *ManagementService) GetWhisperUser(ctx http.Context[*entity.GetWhisperUserRequest, *entity.GetWhisperUserResponse])
func (*ManagementService) ListAllClients ¶
func (srv *ManagementService) ListAllClients(ctx http.Context[*entity.ListClientsRequest, *entity.ListClientResponse])
func (*ManagementService) ListClientModels ¶
func (srv *ManagementService) ListClientModels(ctx http.Context[*entity.ListClientModelRequest, *entity.ListClientModelResponse])
func (*ManagementService) ListWhisperUserBalanceLogs ¶
func (srv *ManagementService) ListWhisperUserBalanceLogs(ctx http.Context[*entity.ListWhisperUserBalanceLogsRequest, *entity.ListWhisperUserBalanceLogsResponse])
func (*ManagementService) ListWhisperUsers ¶
func (srv *ManagementService) ListWhisperUsers(ctx http.Context[*entity.ListWhisperUsersRequest, *entity.ListWhisperUsersResponse])
func (*ManagementService) ModifyClientBalance ¶
func (srv *ManagementService) ModifyClientBalance(ctx http.Context[*entity.ModifyOpenaiClientBalanceRequest, *entity.ModifyOpenaiClientBalanceResponse])
func (*ManagementService) ModifyWhisperUserBalance ¶
func (srv *ManagementService) ModifyWhisperUserBalance(ctx http.Context[*entity.ModifyWhisperUserBalanceRequest, *entity.ModifyWhisperUserBalanceResponse])
func (*ManagementService) ModifyWhisperUserPermissions ¶
func (srv *ManagementService) ModifyWhisperUserPermissions(ctx http.Context[*entity.ModifyWhisperUserPermissionRequest, *entity.ModifyWhisperUserPermissionResponse])
func (*ManagementService) Overview ¶
func (srv *ManagementService) Overview(ctx http.Context[*entity.OverviewRequest, *entity.OverviewResponse])
func (*ManagementService) PreCheckCookie ¶
func (srv *ManagementService) PreCheckCookie(ctx *gin.Context)
func (*ManagementService) UpdateWhisperUser ¶
func (srv *ManagementService) UpdateWhisperUser(ctx http.Context[*entity.UpdateWhisperUserRequest, *entity.CreateWhisperUserResponse])
Click to show internal directories.
Click to hide internal directories.