feat(quota): implement unified quota management system and add community free plan

- Add `default_free_plan.py` to define the configuration for the Community Free Plan.
- Refactor `quota_stub.py` as a unified entry point, delegating checks to `core/quota_manager`.
- Implement core logic in `quota_manager.py` to support retrieving quotas from the premium module or configuration files.
- Update `tenant_subscription_controller` to return Community Free Plan information.
This commit is contained in:
wwq
2026-04-15 18:48:09 +08:00
parent 18be1a9f89
commit 1faa258e23
4 changed files with 567 additions and 43 deletions

View File

@@ -0,0 +1,30 @@
"""
社区版默认免费套餐配置
当无法从 SaaS 版获取 premium 模块时,使用此配置作为兜底
"""
DEFAULT_FREE_PLAN = {
"name": "记忆体验版",
"category": "saas_personal",
"tier_level": 0,
"version": "1.0",
"status": True,
"price": 0,
"billing_cycle": "permanent_free",
"core_value": "感受永久记忆",
"tech_support": "社群交流",
"sla_compliance": "",
"page_customization": "",
"theme_color": "#64748B",
"quotas": {
"workspace_quota": 1,
"skill_quota": 5,
"app_quota": 2,
"knowledge_capacity_quota": 0.3,
"memory_engine_quota": 1,
"end_user_quota": 1,
"ontology_project_quota": 3,
"model_quota": 1,
"api_ops_rate_limit": 50,
},
}