From 7dcf72846183028b7eb32864211f9f492884cc9a Mon Sep 17 00:00:00 2001 From: Ritel-T Date: Tue, 1 Sep 2026 04:31:02 +0900 Subject: [PATCH] Project free Fast into API key auth --- backend/internal/repository/api_key_repo.go | 2 ++ .../api_key_repo_openai_fast_projection_integration_test.go | 3 ++- backend/internal/repository/fixtures_integration_test.go | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/internal/repository/api_key_repo.go b/backend/internal/repository/api_key_repo.go index f1bd5c53d0..14d3aef271 100644 --- a/backend/internal/repository/api_key_repo.go +++ b/backend/internal/repository/api_key_repo.go @@ -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, diff --git a/backend/internal/repository/api_key_repo_openai_fast_projection_integration_test.go b/backend/internal/repository/api_key_repo_openai_fast_projection_integration_test.go index a3e00a541d..f3687c3070 100644 --- a/backend/internal/repository/api_key_repo_openai_fast_projection_integration_test.go +++ b/backend/internal/repository/api_key_repo_openai_fast_projection_integration_test.go @@ -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) } diff --git a/backend/internal/repository/fixtures_integration_test.go b/backend/internal/repository/fixtures_integration_test.go index 987881f143..005ec7d0ba 100644 --- a/backend/internal/repository/fixtures_integration_test.go +++ b/backend/internal/repository/fixtures_integration_test.go @@ -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)