Add secondary development phase one foundation - #5685
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (40)
WalkthroughThis PR introduces a full marketplace management platform. It adds AES-GCM model-key encryption, GORM-backed RBAC and marketplace data models with lifecycle hooks, HTTP controllers with fine-grained permission gating and audit logging, a ChangesMarketplace, RBAC & Audit Platform
Sequence Diagram(s)sequenceDiagram
participant Browser as Browser (React)
participant RouteGuard as beforeLoad (RBAC guard)
participant AuthStore as useAuthStore
participant SecDev as SecondaryDevelopment
participant APIClient as api.ts
participant PermissionAuth as PermissionAuth middleware
participant Controller as marketplace/rbac controller
participant ModelLayer as model/rbac + model/marketplace
participant DB
Browser->>RouteGuard: navigate to /marketplace
RouteGuard->>AuthStore: read user
AuthStore-->>RouteGuard: user + permission_codes
RouteGuard-->>Browser: redirect /403 OR render component
Browser->>SecDev: render MarketplaceConsole
SecDev->>APIClient: getMarketplaceModels()
APIClient->>PermissionAuth: GET /api/marketplace-models + JWT
PermissionAuth->>ModelLayer: UserHasAnyPermission(id, role, perms)
ModelLayer->>DB: query role_permissions
DB-->>ModelLayer: codes
ModelLayer-->>PermissionAuth: allowed
PermissionAuth->>Controller: c.Next()
Controller->>ModelLayer: ListMarketplaceModels(...)
ModelLayer->>DB: SELECT marketplace_models + providers
DB-->>ModelLayer: rows
ModelLayer-->>Controller: []MarketplaceModel
Controller-->>APIClient: ApiSuccess{items, total}
APIClient-->>SecDev: PageData<MarketplaceModel>
SecDev-->>Browser: render model table
Estimated code review effort🎯 5 (Critical) | ⏱️ ~120 minutes Possibly related PRs
Poem
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Closing per requester instruction: this draft PR should not target QuantumNous/new-api. |
Important
binshiz <binshiz@binshizdeMacBook-Air.local>不在仓库历史高频核心作者列表中,本 PR 由 Codex 协助生成并整理。📝 变更描述 / Description
实现二次开发第一阶段的数据和后台底座:在保留现有
role门槛的基础上扩展 RBAC 权限点,新增角色/权限/用户绑定模型、提供商资料与钱包/结算配置、模型广场模型/API 配置/Key/价格/审核记录基础表,并通过 GORM 自动迁移和初始化内置权限。新增权限中间件和 RBAC、Provider、Marketplace Model API;模型 Key 使用
MODEL_KEY_ENCRYPTION_SECRET加密存储,响应只返回脱敏信息。管理写操作、角色绑定和模型/Key/价格/提供商变更会写入操作审计。Default 前端新增模型广场、提供商控制台、财务底座、角色权限、审计日志入口,并按后端返回的权限点做菜单和路由隔离;普通用户仅可进入公开模型广场,提供商仅管理自身资源,财务/运营/超级管理员按矩阵访问对应模块。
🚀 变更类型 / Type of change
🔗 关联任务 / Related Issue
✅ 提交前检查项 / Checklist
Bug fix,我已提交或关联对应 Issue,且不会将设计取舍、预期不一致或理解偏差直接归类为 bug。📸 运行证明 / Proof of Work
已通过本地验证:
说明:本 PR 刻意未包含既有无关工作树改动
web/bun.lock与web/classic/rsbuild.config.ts。Summary by CodeRabbit
Release Notes
New Features
Tests