forked from xiaohei/taiji-AI-PAD
更新计费
This commit is contained in:
@@ -0,0 +1,189 @@
|
||||
# Agent 列表接口新增 modelName 字段
|
||||
|
||||
## 变更说明
|
||||
|
||||
后端已在所有 Agent 列表相关接口的响应中新增 `modelName` 字段,用于显示 Agent 部署时选择的模型名称。
|
||||
|
||||
## 修改的接口
|
||||
|
||||
### 1. GET /api/user/agents/platform
|
||||
|
||||
**描述**: 获取平台 Agent 列表
|
||||
|
||||
**新增字段**: `modelName`
|
||||
|
||||
**响应示例**:
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"data": {
|
||||
"data": [
|
||||
{
|
||||
"id": "uuid",
|
||||
"name": "agent-name",
|
||||
"description": "描述",
|
||||
"category": "通用",
|
||||
"cpu": 0.5,
|
||||
"memory": 1.0,
|
||||
"status": "active",
|
||||
"modelName": "gpt-4o" // 新增字段,可能为 null
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 2. GET /api/user/platform-agents/instances
|
||||
|
||||
**描述**: 获取当前用户的平台 Agent 实例列表
|
||||
|
||||
**新增字段**: `modelName`
|
||||
|
||||
**响应示例**:
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"data": {
|
||||
"instances": [
|
||||
{
|
||||
"instanceName": "echo-agent-xxx",
|
||||
"agentType": "echo_agent",
|
||||
"status": "Running",
|
||||
"startTime": "2026-03-09T10:00:00",
|
||||
"runningSeconds": 3600,
|
||||
"modelName": "gpt-4o" // 新增字段,可能为 null
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 3. GET /api/user/custom-agents
|
||||
|
||||
**描述**: 获取当前用户的自定义 Agent 列表
|
||||
|
||||
**新增字段**: `modelName`
|
||||
|
||||
**响应示例**:
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"data": {
|
||||
"agents": [
|
||||
{
|
||||
"name": "my-custom-agent",
|
||||
"template": "custom_template",
|
||||
"status": "Running",
|
||||
"cpu": "500m",
|
||||
"memory": "1Gi",
|
||||
"startTime": "2026-03-09T10:00:00",
|
||||
"runningSeconds": 3600,
|
||||
"modelName": "gpt-4o" // 新增字段,可能为 null
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 4. GET /api/user/custom-agent-quota
|
||||
|
||||
**描述**: 获取当前租户正在运行的平台 Agent 资源使用情况
|
||||
|
||||
**新增字段**: `agents[].modelName`
|
||||
|
||||
**响应示例**:
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"data": {
|
||||
"totalCpu": 1.5,
|
||||
"totalMemory": 2.0,
|
||||
"agentCount": 3,
|
||||
"agents": [
|
||||
{
|
||||
"agentName": "echo-agent-xxx",
|
||||
"agentType": "echo_agent",
|
||||
"templateName": "echo_agent",
|
||||
"cpuPerPod": 0.5,
|
||||
"memoryPerPod": 0.5,
|
||||
"replicas": 1,
|
||||
"totalCpu": 0.5,
|
||||
"totalMemory": 0.5,
|
||||
"startTime": "2026-03-09T10:00:00",
|
||||
"modelName": "gpt-4o" // 新增字段,可能为 null
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 5. GET /api/user/resources/agents
|
||||
|
||||
**描述**: 获取用户已部署的 Agent 列表(包含 IP 地址和访问信息)
|
||||
|
||||
**新增字段**: `platformAgents[].modelName` 和 `customAgents[].modelName`
|
||||
|
||||
**响应示例**:
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"data": {
|
||||
"platformAgents": [
|
||||
{
|
||||
"name": "echo-agent-xxx",
|
||||
"template": "echo_agent",
|
||||
"templateName": "echo_agent",
|
||||
"status": "Running",
|
||||
"healthStatus": "healthy",
|
||||
"podIp": "10.244.1.100",
|
||||
"externalIp": "20.xxx.xxx.xxx",
|
||||
"domain": "agent-xxx.taiji-ai.com",
|
||||
"domainUrl": "https://agent-xxx.taiji-ai.com",
|
||||
"accessUrl": "https://agent-xxx.taiji-ai.com",
|
||||
"servicePort": 8080,
|
||||
"namespace": "ai-agents",
|
||||
"cpu": "500m",
|
||||
"memory": "1Gi",
|
||||
"replicas": 1,
|
||||
"modelName": "gpt-4o", // 新增字段,可能为 null
|
||||
"startTime": "2026-03-09T10:00:00",
|
||||
"runningSeconds": 3600
|
||||
}
|
||||
],
|
||||
"customAgents": [
|
||||
{
|
||||
"name": "my-custom-agent",
|
||||
"template": "custom_template",
|
||||
"modelName": "claude-3-sonnet", // 新增字段,可能为 null
|
||||
...
|
||||
}
|
||||
],
|
||||
"summary": {
|
||||
"totalPlatformAgents": 1,
|
||||
"totalCustomAgents": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 字段说明
|
||||
|
||||
| 字段名 | 类型 | 说明 |
|
||||
|--------|------|------|
|
||||
| `modelName` | `string \| null` | Agent 部署时选择的模型名称,如 `gpt-4o`、`claude-3-sonnet` 等。如果部署时未指定模型,则为 `null`。 |
|
||||
|
||||
## 前端对接建议
|
||||
|
||||
1. 在 Agent 列表页面显示 `modelName` 字段
|
||||
2. 如果 `modelName` 为 `null`,可显示为 "未指定" 或不显示
|
||||
3. 建议使用模型名称的友好显示名(如 `gpt-4o` → `GPT-4o`)
|
||||
Reference in New Issue
Block a user