feat: Phase 0 - 扩展性基础设施(模块注册/配额注册表/Feature Flags/新增表) #72
Reference in New Issue
Block a user
Delete Branch "feat/phase0-infrastructure"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Phase 0 扩展性基础设施
变更内容
1. 模块注册中心 (
packages/infrastructure/module_registry.py)Module数据类:声明模块名、版本、能力列表、依赖、配置ModuleCapability:模块暴露的能力单元,含配额消耗规则ModuleRegistry:注册/注销/查询/依赖检查/能力发现module_registry2. 配额注册表 (
packages/domain/quota.py重构)QuotaDimension枚举:11 个配额维度(存储/视频数/并发/模板/标题/配音/AI配音等)QuotaTier:3 个套餐等级(free/basic/premium)的配额定义QuotaRegistry:支持模块动态注册新配额维度QuotaChecker:检查用户配额使用量,返回告警级别3. Feature Flags (
packages/infrastructure/feature_flags.py)ai_voice_generation,deduplication_report,batch_export,multi_platform_output,recipe_reusefeature_flags4. 数据库迁移 (
010_phase0_extensibility.py)metadataJSONB 列:projects, asset_libraries, assets, edit_templates, generation_taskstitle_libraries表:独立标题库,支持跨项目复用voice_libraries表:配音库,支持 AI 配音管理models.py同步新增TitleLibraryModel、VoiceLibraryModel新增文件
packages/infrastructure/__init__.pypackages/infrastructure/module_registry.pypackages/infrastructure/feature_flags.pyalembic/versions/010_phase0_extensibility.py修改文件
packages/domain/quota.py(重构为注册表模式)packages/adapters/sqlalchemy_impl/models.py(新增 metadata 列 + 2 个新模型)