Project free Fast into API key auth

This commit is contained in:
Ritel-T
2026-09-01 04:34:24 +09:00
parent fb409787c6
commit 7dcf728461
3 changed files with 5 additions and 1 deletions
@@ -211,6 +211,7 @@ func (r *apiKeyRepository) GetByKeyForAuth(ctx context.Context, key string) (*se
group.FieldAllowMessagesDispatch,
group.FieldAllowLive,
group.FieldForceOpenaiFast,
group.FieldFreeOpenaiFast,
group.FieldDefaultMappedModel,
group.FieldMessagesDispatchModelConfig,
group.FieldModelsListConfig,
@@ -1009,6 +1010,7 @@ func groupEntityToService(g *dbent.Group) *service.Group {
AllowMessagesDispatch: g.AllowMessagesDispatch,
AllowLive: g.AllowLive,
ForceOpenAIFast: g.ForceOpenaiFast,
FreeOpenAIFast: g.FreeOpenaiFast,
RequireOAuthOnly: g.RequireOauthOnly,
RequirePrivacySet: g.RequirePrivacySet,
DefaultMappedModel: g.DefaultMappedModel,
@@ -17,7 +17,7 @@ func TestGetByKeyForAuthCarriesGroupForceOpenAIFast(t *testing.T) {
suffix := time.Now().UnixNano()
group := mustCreateGroup(t, integrationEntClient, &service.Group{
Name: fmt.Sprintf("fast-proj-group-%d", suffix), Platform: service.PlatformOpenAI,
RateMultiplier: 1, ForceOpenAIFast: true,
RateMultiplier: 1, ForceOpenAIFast: true, FreeOpenAIFast: true,
})
user := mustCreateUser(t, integrationEntClient, &service.User{
Email: fmt.Sprintf("fast-proj-%d@example.com", suffix), Concurrency: 5,
@@ -42,4 +42,5 @@ func TestGetByKeyForAuthCarriesGroupForceOpenAIFast(t *testing.T) {
require.NoError(t, err)
require.NotNil(t, got.Group)
require.True(t, got.Group.ForceOpenAIFast)
require.True(t, got.Group.FreeOpenAIFast)
}
@@ -91,6 +91,7 @@ func mustCreateGroup(t *testing.T, client *dbent.Client, g *service.Group) *serv
SetRateMultiplier(g.RateMultiplier).
SetIsExclusive(g.IsExclusive).
SetForceOpenaiFast(g.ForceOpenAIFast).
SetFreeOpenaiFast(g.FreeOpenAIFast).
SetProfitControlEnabled(g.ProfitControlEnabled).
SetProfitMinMargin(g.ProfitMinMargin).
SetProfitSafetyBuffer(g.ProfitSafetyBuffer)