From 77c023102e63054edcf3e0c4c7f89e2fb84e16d0 Mon Sep 17 00:00:00 2001 From: wwq Date: Wed, 22 Apr 2026 11:10:41 +0800 Subject: [PATCH 1/2] feat(plan): bump free plan model quota from 1 to 4 - Increase the model quota for the free tier from 1 to 4. --- api/app/config/default_free_plan.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/app/config/default_free_plan.py b/api/app/config/default_free_plan.py index 409b4f7b..a9ac3c66 100644 --- a/api/app/config/default_free_plan.py +++ b/api/app/config/default_free_plan.py @@ -62,7 +62,7 @@ def _build_default_free_plan(): "memory_engine_quota": 1, "end_user_quota": 1, "ontology_project_quota": 3, - "model_quota": 1, + "model_quota": 4, "api_ops_rate_limit": 50, }, } From eaa4058c56bad642b3be677d6c6f8bfff5c8ef9c Mon Sep 17 00:00:00 2001 From: wwq Date: Wed, 22 Apr 2026 14:12:44 +0800 Subject: [PATCH 2/2] fix(quota_manager): exclude trial users from tenant terminal user count - Deduct trial user records when aggregating the total number of terminal users for a tenant. --- api/app/core/quota_manager.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/api/app/core/quota_manager.py b/api/app/core/quota_manager.py index 534e1940..ad684eb9 100644 --- a/api/app/core/quota_manager.py +++ b/api/app/core/quota_manager.py @@ -179,11 +179,18 @@ class QuotaUsageRepository: def count_end_users(self, tenant_id: UUID) -> int: from app.models.end_user_model import EndUser from app.models.workspace_model import Workspace - return self.db.query(EndUser).join( + from app.models.user_model import User + trial_user_ids = [ + str(u.id) for u in self.db.query(User.id).filter(User.tenant_id == tenant_id).all() + ] + query = self.db.query(EndUser).join( Workspace, EndUser.workspace_id == Workspace.id ).filter( Workspace.tenant_id == tenant_id - ).count() + ) + if trial_user_ids: + query = query.filter(~EndUser.other_id.in_(trial_user_ids)) + return query.count() def count_models(self, tenant_id: UUID) -> int: from app.models.models_model import ModelConfig