Versions in this module Expand all Collapse all v0 v0.0.2 Oct 28, 2024 v0.0.1 Oct 10, 2024 Changes in this version + var ErrorNoAvailableClient = errors.New("no available client") + 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 CheckManagementKeyAvailable(_ context.Context, key string) bool + func CheckManagementKey[req any, res any](ctx http.Context[req, *http.BaseResponse[res]]) + func GetAvailableClient(ctx context.Context, key string, modelName string, promptToken int64, ...) (client openai.Client, metadata *dto.AvailableClientDTO, err error) + type CompatibleService struct + func NewCompatibleService() *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]) + func (srv *CompatibleService) StreamingChatCompletion(ctx *gin.Context) + type ManagementService struct + func NewManagementService() *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(...)