forked from xiaohei/taiji-AI-PAD
更新租户配额
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# 超级管理员控制台 - 接口对接文档
|
||||
|
||||
> **版本**: v1.0.3
|
||||
> **更新时间**: 2026-01-06
|
||||
> **版本**: v1.0.4
|
||||
> **更新时间**: 2026-01-13
|
||||
> **说明**: 本文档基于前端业务需求清单与后端API接口清单核实,列出所有超级管理员端接口的对接状态
|
||||
> **最新测试**: 2026-01-06 14:54 UTC - 所有已对接接口测试通过
|
||||
> **前端代码核对**: 2026-01-06 14:54 UTC - 已完成前端代码与接口文档的一致性核对,修复健康状态判断问题
|
||||
@@ -26,9 +26,9 @@
|
||||
|
||||
| 类别 | 总数 | 已对接 | 未对接 | 对接率 |
|
||||
|------|------|--------|--------|--------|
|
||||
| 数据展示接口 | 12 | 10 | 2 | 83.3% |
|
||||
| 按钮操作接口 | 32 | 27 | 5 | 84.4% |
|
||||
| **合计** | **44** | **37** | **7** | **84.1%** |
|
||||
| 数据展示接口 | 14 | 12 | 2 | 85.7% |
|
||||
| 按钮操作接口 | 34 | 29 | 5 | 85.3% |
|
||||
| **合计** | **48** | **41** | **7** | **85.4%** |
|
||||
|
||||
### 状态说明
|
||||
- ✅ **已对接**: 后端接口已实现,前端可直接调用
|
||||
@@ -748,6 +748,173 @@ curl -i -X DELETE "http://localhost:8002/api/channel/tenants/2c45b96d-c158-466f-
|
||||
|
||||
---
|
||||
|
||||
#### 16. 查看渠道租户资源分配 ✅ 已对接
|
||||
|
||||
| 属性 | 值 |
|
||||
|------|-----|
|
||||
| **接口路径** | `GET /api/admin/channels/{channel_id}/tenants/resources` |
|
||||
| **后端状态** | ✅ 已实现 (admin.py) |
|
||||
| **权限要求** | super_admin, billing_admin, operations_admin, channel_admin |
|
||||
|
||||
**按钮位置**: 渠道管理页面 → 渠道卡片 → "查看租户资源分配"菜单项
|
||||
|
||||
**说明**: 查看渠道下所有租户被分配的资源(自定义Agent、平台Agent、模型)
|
||||
|
||||
**路径参数**:
|
||||
| 参数 | 类型 | 必填 | 说明 |
|
||||
|------|------|------|------|
|
||||
| channel_id | string | 是 | 渠道ID |
|
||||
|
||||
**响应字段**:
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"data": {
|
||||
"channelId": "channel-uuid",
|
||||
"channelName": "渠道名称",
|
||||
"tenants": [
|
||||
{
|
||||
"tenantId": "tenant-uuid",
|
||||
"tenantName": "租户名称",
|
||||
"tenantEmail": "tenant@example.com",
|
||||
"status": "active",
|
||||
"createdAt": "2026-01-01T00:00:00Z",
|
||||
"customAgentQuota": {
|
||||
"cpuQuota": 2.0,
|
||||
"memoryQuota": 4.0,
|
||||
"cpuUsed": 1.0,
|
||||
"memoryUsed": 2.0,
|
||||
"agentCount": 2
|
||||
},
|
||||
"platformAgents": [
|
||||
{
|
||||
"templateName": "echo_agent",
|
||||
"podQuota": 5,
|
||||
"podUsed": 2,
|
||||
"cpuPerPod": "100m",
|
||||
"memoryPerPod": "256Mi"
|
||||
}
|
||||
],
|
||||
"models": [
|
||||
{
|
||||
"modelName": "gpt-4o",
|
||||
"rpmLimit": 1000,
|
||||
"tpmLimit": 100000,
|
||||
"maxBudget": 500.0,
|
||||
"budgetDuration": "monthly"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"summary": {
|
||||
"totalTenants": 5,
|
||||
"tenantsWithCustomAgents": 3,
|
||||
"tenantsWithPlatformAgents": 4,
|
||||
"tenantsWithModels": 5,
|
||||
"totalCustomAgentCpuQuota": 10.0,
|
||||
"totalCustomAgentMemoryQuota": 20.0,
|
||||
"totalCustomAgentCpuUsed": 5.0,
|
||||
"totalCustomAgentMemoryUsed": 10.0,
|
||||
"totalPlatformAgentPodQuota": 25,
|
||||
"totalPlatformAgentPodUsed": 10
|
||||
}
|
||||
},
|
||||
"message": "获取渠道租户资源分配成功"
|
||||
}
|
||||
```
|
||||
|
||||
> **权限说明**: 渠道管理员只能查看自己所属渠道的租户资源分配
|
||||
|
||||
**前端调用**: `TaijiAPIClient.getChannelTenantsResources(channelId)`
|
||||
|
||||
---
|
||||
|
||||
#### 17. 渠道管理员查看租户资源分配汇总 ✅ 已对接
|
||||
|
||||
| 属性 | 值 |
|
||||
|------|-----|
|
||||
| **接口路径** | `GET /api/channel/tenants/resources/summary` |
|
||||
| **后端状态** | ✅ 已实现 (channel.py) |
|
||||
| **权限要求** | channel_admin, billing_admin, operations_admin, super_admin |
|
||||
|
||||
**按钮位置**: 渠道管理控制台 → 租户管理 → "资源分配汇总"
|
||||
|
||||
**说明**: 渠道管理员查看自己渠道下所有租户的资源分配汇总,包括渠道配额和租户分配情况对比
|
||||
|
||||
**查询参数**:
|
||||
| 参数 | 类型 | 必填 | 说明 |
|
||||
|------|------|------|------|
|
||||
| channel_id | string | 否 | 渠道ID(超级管理员必填,其他管理员自动使用所属渠道) |
|
||||
|
||||
**响应字段**:
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"data": {
|
||||
"channelId": "channel-uuid",
|
||||
"channelName": "渠道名称",
|
||||
"channelQuota": {
|
||||
"customAgentQuota": {
|
||||
"cpuQuota": 20.0,
|
||||
"memoryQuota": 40.0,
|
||||
"cpuAllocated": 10.0,
|
||||
"memoryAllocated": 20.0
|
||||
},
|
||||
"platformAgents": [
|
||||
{
|
||||
"templateName": "echo_agent",
|
||||
"podQuota": 50,
|
||||
"podUsed": 10,
|
||||
"cpuPerPod": "100m",
|
||||
"memoryPerPod": "256Mi"
|
||||
}
|
||||
],
|
||||
"models": ["gpt-4o", "claude-3-opus"]
|
||||
},
|
||||
"tenants": [
|
||||
{
|
||||
"tenantId": "tenant-uuid",
|
||||
"tenantName": "租户名称",
|
||||
"tenantEmail": "tenant@example.com",
|
||||
"status": "active",
|
||||
"subscriptionTier": "pro",
|
||||
"balance": 1000.0,
|
||||
"createdAt": "2026-01-01T00:00:00Z",
|
||||
"customAgentQuota": {
|
||||
"cpuQuota": 2.0,
|
||||
"memoryQuota": 4.0,
|
||||
"cpuUsed": 1.0,
|
||||
"memoryUsed": 2.0,
|
||||
"agentCount": 2
|
||||
},
|
||||
"platformAgents": [...],
|
||||
"models": [...]
|
||||
}
|
||||
],
|
||||
"summary": {
|
||||
"totalTenants": 5,
|
||||
"tenantsWithCustomAgents": 3,
|
||||
"tenantsWithPlatformAgents": 4,
|
||||
"tenantsWithModels": 5,
|
||||
"totalCustomAgentCpuQuota": 10.0,
|
||||
"totalCustomAgentMemoryQuota": 20.0,
|
||||
"totalCustomAgentCpuUsed": 5.0,
|
||||
"totalCustomAgentMemoryUsed": 10.0,
|
||||
"totalPlatformAgentPodQuota": 25,
|
||||
"totalPlatformAgentPodUsed": 10,
|
||||
"totalModelsAllocated": 10
|
||||
}
|
||||
},
|
||||
"message": "获取渠道租户资源分配成功"
|
||||
}
|
||||
```
|
||||
|
||||
> **使用场景**: 渠道管理员可以查看渠道的总配额与已分配给租户的配额对比,方便进行资源管理
|
||||
|
||||
**前端调用**: `TaijiAPIClient.getChannelTenantsResourcesSummary(channelId)`
|
||||
|
||||
---
|
||||
|
||||
## 资源管理模块 (Resources)
|
||||
|
||||
### 数据展示接口
|
||||
@@ -1351,6 +1518,8 @@ curl -i -X DELETE "http://localhost:8002/api/channel/tenants/2c45b96d-c158-466f-
|
||||
| 32 | /api/admin/admins/create | POST | 创建管理员 | 设置 |
|
||||
| 33 | /api/admin/admins/{admin_id} | DELETE | 删除管理员 | 设置 |
|
||||
| 34 | /api/admin/roles | GET | 角色列表 | 设置 |
|
||||
| 35 | /api/admin/channels/{channel_id}/tenants/resources | GET | 查看渠道租户资源分配 | 渠道管理 |
|
||||
| 36 | /api/channel/tenants/resources/summary | GET | 渠道管理员查看租户资源汇总 | 渠道管理 |
|
||||
|
||||
---
|
||||
|
||||
@@ -1444,6 +1613,12 @@ curl -i -X DELETE "http://localhost:8002/api/channel/tenants/2c45b96d-c158-466f-
|
||||
|
||||
## 更新日志
|
||||
|
||||
### v1.0.4 (2026-01-13)
|
||||
|
||||
- 新增 `GET /api/admin/channels/{channel_id}/tenants/resources` 接口:查看渠道下所有租户的资源分配(自定义Agent、平台Agent、模型)
|
||||
- 新增 `GET /api/channel/tenants/resources/summary` 接口:渠道管理员查看租户资源分配汇总,包含渠道配额对比
|
||||
- 支持超级管理员和渠道管理员查看租户资源分配情况
|
||||
|
||||
### v1.0.1 (2026-01-06)
|
||||
|
||||
- 完成所有已对接接口的实际测试
|
||||
|
||||
Reference in New Issue
Block a user