Files
taiji-AI-PAD/Docs/租户用户端-后端接口需求清单.md
T
2026-01-06 16:00:33 +00:00

24 KiB
Raw Blame History

租户用户端 - 后端接口需求清单

版本: v1.0.0 更新时间: 2026-01-06 说明: 本文档基于前端业务逻辑分析,列出所有后端接口需求,包括已对接接口和未对接接口,按钮操作接口和数据展示接口


目录

  1. 认证模块 (Authentication)
  2. 概览模块 (Dashboard Overview)
  3. 服务网关模块 (Service Gateway)
  4. 数据与工具模块 (Data & Tools)
  5. 代理工厂模块 (Agent Factory)
  6. 编排中心模块 (Orchestration Hub)
  7. 计费与资源模块 (Billing & Resources)
  8. 附录:接口汇总表

认证模块 (Authentication)

按钮操作接口

B1. 用户登录接口 ✅ 已对接

触发位置: 登录页面 → "登录" 按钮

功能描述: 租户用户使用邮箱和密码登录系统

接口:

POST /api/auth/login

请求参数:

字段 类型 必填 说明
email string 是 用户邮箱
password string 是 用户密码
role string 是 角色类型,固定为 "user"

响应字段:

字段 类型 说明
success bool 是否成功
data.token string JWT访问令牌
data.refreshToken string 刷新令牌
data.user object 用户信息

前端调用: TaijiAPIClient.login(email, password, "user")


B2. 用户登出接口 ✅ 已对接

触发位置: 顶部导航栏 → 用户菜单 → "退出登录"

功能描述: 用户退出登录,清除会话

接口:

POST /api/auth/logout

前端调用: TaijiAPIClient.logout()


B3. 刷新Token接口 ✅ 已对接

触发位置: 系统自动调用(Token即将过期时)

功能描述: 刷新访问令牌

接口:

POST /api/auth/refresh

响应字段:

字段 类型 说明
success bool 是否成功
data.token string 新的JWT访问令牌
data.refreshToken string 新的刷新令牌

前端调用: TaijiAPIClient.refreshToken()


B4. 修改密码接口 ✅ 已对接

触发位置: 用户菜单 → 设置 → 修改密码

功能描述: 用户修改自己的密码

接口:

PUT /api/auth/password

请求参数:

字段 类型 必填 说明
old_password string 是 旧密码
new_password string 是 新密码

前端调用: TaijiAPIClient.changePassword(oldPassword, newPassword)


B5. 重新生成API密钥接口 ✅ 已对接

触发位置: 顶部导航栏 → 用户菜单 → "密钥管理" → "重新生成" 按钮

功能描述: 重新生成用户的API密钥

接口:

POST /api/auth/keys/regenerate

响应字段:

字段 类型 说明
success bool 是否成功
data.apiKey string 新的API密钥
data.message string 提示信息

前端调用: TaijiAPIClient.regenerateApiKey()


数据展示接口

D1. 获取API密钥信息接口 ✅ 已对接

展示位置: 顶部导航栏 → 用户菜单 → "密钥管理" 对话框

展示内容:

  • 服务终结点 URL
  • API密钥(脱敏显示)

接口:

GET /api/auth/keys/info

前端调用: TaijiAPIClient.getApiKeyInfo()


概览模块 (Dashboard Overview)

数据展示接口

D2. 用户仪表板统计接口 ✅ 已对接

展示位置: 概览页面 → 顶部统计卡片区域

展示内容:

  • 活跃代理数(Active Agents)
  • 全局API调用数(Global API Calls)
  • EU余额(EU Balance)
  • 系统健康度(System Health)

功能描述: 获取当前租户的仪表板统计数据

接口:

GET /api/user/dashboard/stats

响应字段:

字段 类型 说明
success bool 是否成功
data.activeAgents int 活跃代理数
data.totalRequests int 总请求数
data.euBalance float EU余额
data.systemHealth int 系统健康度百分比

前端调用: TaijiAPIClient.getUserDashboardStats()


D3. 监控仪表盘接口 ✅ 已对接

展示位置: 概览页面 → 系统组件状态区域

展示内容:

  • 各服务组件状态(MCP Server、Data Ingestion、API Gateway等)
  • 组件延迟信息

接口:

GET /api/v1/monitoring/dashboard

响应字段:

字段 类型 说明
health.services object 各服务健康状态
metrics object 性能指标

前端调用: TaijiAPIClient.getMonitoringDashboard()


D4. 计费余额接口 ✅ 已对接

展示位置: 概览页面 → EU余额卡片

展示内容:

  • EU余额
  • 账户余额

接口:

GET /api/user/billing/balance

响应字段:

字段 类型 说明
success bool 是否成功
data.balance float 账户余额
data.euBalance float EU余额

前端调用: TaijiAPIClient.getBillingBalance()


D5. 监控趋势数据接口 ✅ 已对接

展示位置: 概览页面 → EU消耗图表

展示内容:

  • 过去24小时EU消耗趋势

接口:

GET /api/v1/monitoring/trends

请求参数:

字段 类型 必填 说明
metric string 否 指标类型:executions, eu_consumption
period string 否 时间周期:24h, 7d, 30d
interval string 否 时间间隔:1h, 6h, 1d

前端调用: TaijiAPIClient.getMonitoringTrends({ metric, period, interval })


服务网关模块 (Service Gateway)

按钮操作接口

B6. 创建API接口 ✅ 已对接

触发位置: 服务网关页面 → "创建API" 按钮

功能描述: 通过上传JSON文件或提供URL创建API接口

接口:

POST /api/user/gateway/api/create

请求参数:

字段 类型 必填 说明
name string 是 API名称
method string 是 上传方式:json 或 url
content string 是 JSON内容或URL地址

前端调用: TaijiAPIClient.createGatewayAPI(name, method, content)


B7. 选择网关类型接口 ✅ 已对接

触发位置: 服务网关页面 → 网关类型选择

功能描述: 选择使用的服务网关类型(MCP、A2A、API)

接口:

POST /api/user/gateway/select

请求参数:

字段 类型 必填 说明
gatewayType string 是 网关类型:MCP, A2A, API

前端调用: TaijiAPIClient.selectGateway(gatewayType)


数据展示接口

D6. 网关API列表接口 ✅ 已对接

展示位置: 服务网关页面 → 统计卡片(服务端点数)

展示内容:

  • 已创建的API列表
  • 服务端点数量

接口:

GET /api/user/gateway/apis

响应字段:

字段 类型 说明
success bool 是否成功
data.apis array API列表

前端调用: TaijiAPIClient.getGatewayAPIs()


D7. 网关监控数据接口 ✅ 已对接

展示位置: 服务网关页面 → 监控Tab

展示内容:

  • 平均延迟
  • 今日请求数
  • 各提供商请求分布

接口:

GET /api/user/gateway/monitoring

响应字段:

字段 类型 说明
success bool 是否成功
data.averageLatency int 平均延迟(ms)
data.requestsPerMinute int 每分钟请求数

前端调用: TaijiAPIClient.getGatewayMonitoring()


D8. 模型提供商列表接口 ✅ 已对接

展示位置: 服务网关页面 → 监控Tab → 模型提供商监控

展示内容:

  • 各模型提供商名称
  • 请求数量
  • 延迟
  • 状态

接口:

GET /api/providers/models

响应字段:

字段 类型 说明
success bool 是否成功
data.providers array 提供商列表

前端调用: TaijiAPIClient.getModelProviders()


数据与工具模块 (Data & Tools)

按钮操作接口

B8. 生成工具接口 ✅ 已对接

触发位置: 数据与工具页面 → "生成新工具" 按钮 → 对话框 → "部署工具和Pod"

功能描述: 根据Agent框架模板生成工具并部署Pod

接口:

POST /api/user/tools/generate

请求参数:

字段 类型 必填 说明
name string 是 工具名称
description string 否 工具描述
frameworkTemplate string 是 框架模板:langchain, a2a, api
gateway string 是 服务网关:mcp-gateway, a2a-gateway, api-gateway
agentCount int 是 Agent个数
cpu int 是 CPU核数
memory int 是 内存大小(GB)
maxScale int 是 可扩展Agent数量
model string 是 使用的模型

前端调用: TaijiAPIClient.generateTool(data)


B9. 创建数据模板接口 ✅ 已对接

触发位置: 数据与工具页面 → 数据模板Tab → "创建数据模板" 按钮

功能描述: 创建JSON API模板或云存储数据库模板

接口:

POST /api/user/data-templates/create

请求参数:

字段 类型 必填 说明
name string 是 模板名称
type string 是 模板类型:json_api, cloud_storage
config object 是 配置信息(URL、密钥、连接字符串等)

前端调用: TaijiAPIClient.createDataTemplate(data)


数据展示接口

D9. 工具列表接口 ✅ 已对接

展示位置: 数据与工具页面 → 可用工具Tab → 工具注册表

展示内容:

  • 工具名称
  • 类别
  • 方法(GET/POST等)
  • 端点URL
  • 状态
  • 创建时间

接口:

GET /tools

请求参数:

字段 类型 必填 说明
category string 否 工具类别
limit int 否 返回数量限制
offset int 否 偏移量

前端调用: TaijiAPIClient.getTools()


D10. 统计信息接口 ✅ 已对接

展示位置: 数据与工具页面 → 顶部统计卡片

展示内容:

  • 总API数
  • 生成的工具数
  • 活跃Pod数

接口:

GET /stats

响应字段:

字段 类型 说明
total_apis int 总API数
generated_tools int 生成的工具数
active_pods int 活跃Pod数

前端调用: TaijiAPIClient.getStats()


代理工厂模块 (Agent Factory)

按钮操作接口

B10. 部署Agent接口 ✅ 已对接

触发位置: 代理工厂页面 → Agent卡片 → "部署Agent" 按钮 → 对话框 → "确认部署"

功能描述: 部署平台原生Agent到用户资源

接口:

POST /api/user/agents/deploy

请求参数:

字段 类型 必填 说明
agentId string 是 Agent ID
instances int 是 实例数量
model string 是 使用的模型
gateway string 是 服务网关:MCP, A2A, API

前端调用: TaijiAPIClient.deployAgent(data)


B11. 创建自定义Agent接口 ✅ 已对接

触发位置: 代理工厂页面 → 自定义Agent区域(如有)

功能描述: 创建租户自定义的Agent

接口:

POST /api/user/agents/custom/create

请求参数:

字段 类型 必填 说明
name string 是 Agent名称
description string 否 Agent描述
category string 否 类别
role string 是 角色定义
goal string 是 目标定义
tools array 否 工具列表
config object 否 配置(temperature, max_tokens等)

前端调用: TaijiAPIClient.createCustomAgent(data)


数据展示接口

D11. 平台Agent列表接口 ✅ 已对接

展示位置: 代理工厂页面 → 平台原生Agent库

展示内容:

  • Agent图标
  • Agent名称
  • Agent描述
  • 核心能力标签
  • 状态

接口:

GET /api/user/agents/platform

响应字段:

字段 类型 说明
success bool 是否成功
data.data array Agent列表

前端调用: TaijiAPIClient.getPlatformAgents()


D12. 已部署Agent列表接口 ✅ 已对接

展示位置: 代理工厂页面 → 已部署Agent统计卡片

展示内容:

  • 已部署Agent数量
  • 运行中的Agent

接口:

GET /agents

请求参数:

字段 类型 必填 说明
skip int 否 跳过数量
limit int 否 返回数量限制

前端调用: TaijiAPIClient.getAgents(skip, limit)


D13. 自定义Agent列表接口 ✅ 已对接

展示位置: 代理工厂页面 → 自定义Agent区域

展示内容:

  • 自定义Agent列表

接口:

GET /api/user/agents/custom

前端调用: TaijiAPIClient.getCustomAgents()


编排中心模块 (Orchestration Hub)

按钮操作接口

B12. 创建工作流接口 ✅ 已对接

触发位置: 编排中心页面 → "创建工作流" 按钮 → 对话框 → "保存工作流"

功能描述: 创建Agent工作流(最多3个节点)

接口:

POST /api/user/workflows/create

请求参数:

字段 类型 必填 说明
name string 是 工作流名称
description string 否 工作流描述
gateway string 是 服务网关:MCP, A2A, API
nodes array 是 节点列表(最多3个)
nodes[].agentId string 是 Agent ID
nodes[].agentType string 是 Agent类型:platform, custom
nodes[].agentName string 是 Agent名称
nodes[].order int 是 节点顺序

前端调用: TaijiAPIClient.createWorkflow(data)


B13. 运行工作流接口 ⚠️ 待确认

触发位置: 编排中心页面 → 工作流卡片 → "运行" 按钮

功能描述: 执行指定的工作流

接口:

POST /api/user/workflows/{workflow_id}/run

请求参数:

字段 类型 必填 说明
workflow_id string 是 工作流ID(路径参数)
input object 否 输入参数

前端调用: 待实现


B14. 删除工作流接口 ⚠️ 待确认

触发位置: 编排中心页面 → 工作流卡片 → 删除按钮

功能描述: 删除指定的工作流

接口:

DELETE /api/user/workflows/{workflow_id}

前端调用: 待实现


数据展示接口

D14. 工作流列表接口 ✅ 已对接

展示位置: 编排中心页面 → 我的工作流

展示内容:

  • 工作流名称
  • 状态(running/stopped)
  • 节点数量

接口:

GET /api/user/workflows

响应字段:

字段 类型 说明
success bool 是否成功
data.data array 工作流列表
data.data[].id string 工作流ID
data.data[].name string 工作流名称
data.data[].status string 状态
data.data[].nodes array 节点列表

前端调用: TaijiAPIClient.getWorkflows()


计费与资源模块 (Billing & Resources)

按钮操作接口

B15. 充值接口 ✅ 已对接

触发位置: 计费与资源页面 → 账户余额卡片 → "充值" 按钮 → 对话框 → "确认充值"

功能描述: 为账户充值

接口:

POST /api/user/billing/recharge

请求参数:

字段 类型 必填 说明
amount float 是 充值金额
paymentMethod string 否 支付方式:alipay, wechat, card

前端调用: TaijiAPIClient.rechargeBalance(amount, paymentMethod)


B16. 导出账单接口 ⚠️ 待确认

触发位置: 计费与资源页面 → "导出" 按钮 → 选择格式

功能描述: 导出账单数据为Excel/CSV/PDF格式

接口:

GET /api/user/billing/history?export={format}

请求参数:

字段 类型 必填 说明
startTime string 是 开始时间
endTime string 是 结束时间
export string 是 导出格式:excel, csv, pdf

前端调用: TaijiAPIClient.getBillingHistory({ ...params, export: format })


数据展示接口

D15. 计费余额接口 ✅ 已对接

展示位置: 计费与资源页面 → 账户余额卡片、EU余额卡片

展示内容:

  • 账户余额(¥)
  • 本月已消费
  • EU余额

接口:

GET /api/user/billing/balance

响应字段:

字段 类型 说明
success bool 是否成功
data.balance float 账户余额
data.monthlySpent float 本月消费
data.euBalance float EU余额

前端调用: TaijiAPIClient.getBillingBalance()


D16. 计费历史接口 ✅ 已对接

展示位置: 计费与资源页面 → EU消费历史图表、费用明细图表

展示内容:

  • 每日EU消耗趋势
  • 按类别的费用明细

接口:

GET /api/user/billing/history

请求参数:

字段 类型 必填 说明
startTime string 是 开始时间(ISO格式)
endTime string 是 结束时间(ISO格式)
customerName string 否 客户名称筛选
minCalls int 否 最小调用次数
maxCalls int 否 最大调用次数
page int 否 页码
pageSize int 否 每页数量

响应字段:

字段 类型 说明
success bool 是否成功
data.records array 计费记录列表
data.records[].timestamp string 时间戳
data.records[].eu float EU消耗
data.records[].cost float 费用
data.records[].agentType string Agent类型

前端调用: TaijiAPIClient.getBillingHistory(params)


附录:接口汇总表

按钮操作接口汇总

序号 接口名称 方法 路径 状态 所属模块
B1 用户登录 POST /api/auth/login ✅ 已对接 认证
B2 用户登出 POST /api/auth/logout ✅ 已对接 认证
B3 刷新Token POST /api/auth/refresh ✅ 已对接 认证
B4 修改密码 PUT /api/auth/password ✅ 已对接 认证
B5 重新生成API密钥 POST /api/auth/keys/regenerate ✅ 已对接 认证
B6 创建API POST /api/user/gateway/api/create ✅ 已对接 服务网关
B7 选择网关类型 POST /api/user/gateway/select ✅ 已对接 服务网关
B8 生成工具 POST /api/user/tools/generate ✅ 已对接 数据与工具
B9 创建数据模板 POST /api/user/data-templates/create ✅ 已对接 数据与工具
B10 部署Agent POST /api/user/agents/deploy ✅ 已对接 代理工厂
B11 创建自定义Agent POST /api/user/agents/custom/create ✅ 已对接 代理工厂
B12 创建工作流 POST /api/user/workflows/create ✅ 已对接 编排中心
B13 运行工作流 POST /api/user/workflows/{id}/run ⚠️ 待确认 编排中心
B14 删除工作流 DELETE /api/user/workflows/{id} ⚠️ 待确认 编排中心
B15 充值 POST /api/user/billing/recharge ✅ 已对接 计费与资源
B16 导出账单 GET /api/user/billing/history?export= ⚠️ 待确认 计费与资源

数据展示接口汇总

序号 接口名称 方法 路径 状态 所属模块
D1 获取API密钥信息 GET /api/auth/keys/info ✅ 已对接 认证
D2 用户仪表板统计 GET /api/user/dashboard/stats ✅ 已对接 概览
D3 监控仪表盘 GET /api/v1/monitoring/dashboard ✅ 已对接 概览
D4 计费余额 GET /api/user/billing/balance ✅ 已对接 概览
D5 监控趋势数据 GET /api/v1/monitoring/trends ✅ 已对接 概览
D6 网关API列表 GET /api/user/gateway/apis ✅ 已对接 服务网关
D7 网关监控数据 GET /api/user/gateway/monitoring ✅ 已对接 服务网关
D8 模型提供商列表 GET /api/providers/models ✅ 已对接 服务网关
D9 工具列表 GET /tools ✅ 已对接 数据与工具
D10 统计信息 GET /stats ✅ 已对接 数据与工具
D11 平台Agent列表 GET /api/user/agents/platform ✅ 已对接 代理工厂
D12 已部署Agent列表 GET /agents ✅ 已对接 代理工厂
D13 自定义Agent列表 GET /api/user/agents/custom ✅ 已对接 代理工厂
D14 工作流列表 GET /api/user/workflows ✅ 已对接 编排中心
D15 计费余额 GET /api/user/billing/balance ✅ 已对接 计费与资源
D16 计费历史 GET /api/user/billing/history ✅ 已对接 计费与资源

接口统计

按状态统计

状态 数量 占比
✅ 已对接 29 90.6%
⚠️ 待确认 3 9.4%
❌ 未对接 0 0%
总计 32 100%

按模块统计

模块 按钮操作接口 数据展示接口 合计
认证模块 5 1 6
概览模块 0 4 4
服务网关模块 2 3 5
数据与工具模块 2 2 4
代理工厂模块 2 3 5
编排中心模块 3 1 4
计费与资源模块 2 2 4
总计 16 16 32

待确认接口说明

B13. 运行工作流接口

问题: 前端页面有"运行"按钮,但API客户端中未找到对应的接口实现。

建议: 需要后端确认是否已实现 POST /api/user/workflows/{workflow_id}/run 接口。

B14. 删除工作流接口

问题: 前端页面有删除按钮,但API客户端中未找到对应的接口实现。

建议: 需要后端确认是否已实现 DELETE /api/user/workflows/{workflow_id} 接口。

B16. 导出账单接口

问题: 前端有导出功能UI,但实际导出逻辑可能需要后端返回文件流。

建议: 需要确认后端是否支持 export 参数返回文件下载。


前端调用示例

登录流程

// 1. 用户登录
const result = await TaijiAPIClient.login(email, password, "user")
if (result.success) {
  // token 自动存储到 localStorage
  window.location.href = "/"
}

仪表板数据加载

// 并行加载仪表板数据
const [dashboardStats, monitoringDashboard, billingBalance] = await Promise.allSettled([
  TaijiAPIClient.getUserDashboardStats(),
  TaijiAPIClient.getMonitoringDashboard(),
  TaijiAPIClient.getBillingBalance(),
])

部署Agent流程

// 部署平台Agent
const result = await TaijiAPIClient.deployAgent({
  agentId: selectedAgent.id,
  instances: deployConfig.agentCount,
  model: deployConfig.model,
  gateway: deployConfig.serviceGateway as "MCP" | "A2A" | "API",
})

创建工作流流程

// 创建工作流
const result = await TaijiAPIClient.createWorkflow({
  name: workflowName,
  gateway: selectedGateway as "MCP" | "A2A" | "API",
  nodes: workflowNodes.map((nodeId, index) => ({
    agentId: nodeId,
    agentType: agent?.type === "custom" ? "custom" : "platform",
    agentName: agent?.name || "",
    order: index + 1,
  })),
})

版本历史

版本 日期 更新内容
v1.0.0 2026-01-06 初始版本,基于前端代码分析生成