diff --git a/Docs/用户资源信息查询接口文档.md b/Docs/用户资源信息查询接口文档.md index de1da4f..bc774b4 100644 --- a/Docs/用户资源信息查询接口文档.md +++ b/Docs/用户资源信息查询接口文档.md @@ -88,15 +88,15 @@ Content-Type: application/json | 字段 | 类型 | 说明 | 示例 | |------|------|------|------| -| `modelName` | string | 模型名称 | `"azure/gpt-4"` | -| `apiKey` | string | **解密后的完整 API Key**(用于调用模型) | `"sk-xxxxxxxxxxxxxxxx"` | -| `apiBase` | string | LiteLLM 网关地址 | `"https://litellm.xxx.azurecontainerapps.io"` | -| `rpmLimit` | integer | 每分钟请求数限制 | `60` | -| `tpmLimit` | integer | 每分钟 Token 数限制 | `10000` | -| `maxBudget` | number \| null | 最大预算(美元) | `100.0` | +| `modelName` | string | 模型名称 | `"taiji/gpt-4o-mini"` | +| `apiKey` | string | **解密后的完整 API Key**(用于调用模型) | `"sk-cqlSIMr1v4H3PC1LiOuXKg"` | +| `apiBase` | string | LiteLLM 网关地址 | `"https://litellm.graystone-fb459c5d.southeastasia.azurecontainerapps.io"` | +| `rpmLimit` | integer | 每分钟请求数限制 | `10` | +| `tpmLimit` | integer | 每分钟 Token 数限制 | `10` | +| `maxBudget` | number \| null | 最大预算(美元) | `500.0` | | `budgetDuration` | string | 预算周期 | `"monthly"` | | `status` | string | 密钥状态 | `"active"` | -| `createdAt` | string | 创建时间(ISO 8601) | `"2026-01-13T10:00:00"` | +| `createdAt` | string | 创建时间(ISO 8601) | `"2026-01-09T06:20:12.334386"` | | `error` | string | 错误信息(仅解密失败时返回) | `"密钥解密失败"` | --- @@ -116,37 +116,37 @@ Content-Type: application/json ```json { "success": true, - "message": "LiteLLM 密钥信息获取成功", "data": { "litellmKeys": [ { - "modelName": "azure/gpt-4", - "apiKey": "sk-1234567890abcdef1234567890abcdef", + "modelName": "taiji/gpt-4o-mini", + "apiKey": "sk-cqlSIMr1v4H3PC1LiOuXKg", "apiBase": "https://litellm.graystone-fb459c5d.southeastasia.azurecontainerapps.io", - "rpmLimit": 60, - "tpmLimit": 10000, - "maxBudget": 100.0, + "rpmLimit": 10, + "tpmLimit": 10, + "maxBudget": 500.0, "budgetDuration": "monthly", "status": "active", - "createdAt": "2026-01-10T10:30:00" + "createdAt": "2026-01-09T06:20:12.334386" }, { - "modelName": "azure/gpt-3.5-turbo", - "apiKey": "sk-abcdef1234567890abcdef1234567890", + "modelName": "taiji/gpt-5", + "apiKey": "sk-Cjw3WZ7w3XMH5LjXnYw2ZA", "apiBase": "https://litellm.graystone-fb459c5d.southeastasia.azurecontainerapps.io", - "rpmLimit": 120, - "tpmLimit": 50000, - "maxBudget": 50.0, + "rpmLimit": 100, + "tpmLimit": 100, + "maxBudget": 500.0, "budgetDuration": "monthly", "status": "active", - "createdAt": "2026-01-10T10:30:00" + "createdAt": "2026-01-09T08:35:09.780817" } ], "litellmApiBase": "https://litellm.graystone-fb459c5d.southeastasia.azurecontainerapps.io", "summary": { "totalLitellmKeys": 2 } - } + }, + "message": "LiteLLM 密钥信息获取成功" } ``` @@ -155,14 +155,14 @@ Content-Type: application/json ```json { "success": true, - "message": "LiteLLM 密钥信息获取成功", "data": { "litellmKeys": [], "litellmApiBase": "https://litellm.graystone-fb459c5d.southeastasia.azurecontainerapps.io", "summary": { "totalLitellmKeys": 0 } - } + }, + "message": "LiteLLM 密钥信息获取成功" } ``` @@ -197,7 +197,7 @@ client = openai.OpenAI( ) response = client.chat.completions.create( - model="azure/gpt-4", + model="taiji/gpt-4o-mini", messages=[{"role": "user", "content": "Hello!"}] ) ``` @@ -277,32 +277,22 @@ Content-Type: application/json | 字段 | 类型 | 说明 | 示例 | |------|------|------|------| -| `name` | string | Agent 实例名称 | `"user-123-echo-agent-abc"` | +| `name` | string | Agent 实例名称 | `"echo-agent-b00a7b8e-fa5a66"` | | `template` | string | Agent 类型/模板 | `"echo_agent"` | | `templateName` | string | 模板名称 | `"echo_agent"` | -| `status` | string | 运行状态(AKS 实时) | `"Running"` / `"Pending"` / `"Failed"` | -| `healthStatus` | string | 健康状态(AKS 实时) | `"healthy"` / `"unhealthy"` / `"unknown"` | -| `podIp` | string \| null | **Pod IP 地址**(AKS 实时) | `"10.244.1.100"` | -| `accessUrl` | string \| null | **访问 URL**(AKS 实时) | `"http://xxx.ai-agents.svc.cluster.local:8080"` | -| `servicePort` | integer \| null | 服务端口 | `8080` | +| `status` | string | 运行状态(AKS 实时) | `"Running"` / `"Waiting"` / `"Pending"` / `"Failed"` | +| `healthStatus` | string | 健康状态(AKS 实时) | `"healthy"` / `"degraded"` / `"unhealthy"` / `"unknown"` | +| `podIp` | string \| null | **Pod IP 地址**(AKS 实时) | `"10.244.2.103"` | +| `accessUrl` | string \| null | **访问 URL**(AKS 实时) | `null` | +| `servicePort` | integer \| null | 服务端口 | `null` | | `namespace` | string | K8s 命名空间 | `"ai-agents"` | -| `hostIp` | string \| null | 宿主机 IP(AKS 实时) | `"192.168.1.10"` | -| `nodeName` | string \| null | 节点名称(AKS 实时) | `"aks-agentpool-xxxxx"` | +| `hostIp` | string \| null | 宿主机 IP(AKS 实时) | `null` | +| `nodeName` | string \| null | 节点名称(AKS 实时) | `null` | | `cpu` | string | CPU 配置 | `"100m"` | | `memory` | string | 内存配置 | `"256Mi"` | | `replicas` | integer | 副本数量 | `1` | -| `startTime` | string | 启动时间(ISO 8601) | `"2026-01-13T08:00:00"` | -| `runningSeconds` | integer | 已运行秒数 | `7200` | -| `endpoints` | array | 端点列表(可选) | 见下表 | - -### endpoints 数组元素(可选) - -| 字段 | 类型 | 说明 | 示例 | -|------|------|------|------| -| `name` | string | 端点名称 | `"http"` | -| `port` | integer | 端口号 | `8080` | -| `protocol` | string | 协议 | `"TCP"` | -| `targetPort` | integer | 目标端口 | `8080` | +| `startTime` | string | 启动时间(ISO 8601) | `"2026-01-11T15:17:17.579421"` | +| `runningSeconds` | integer | 已运行秒数 | `227937` | --- @@ -310,8 +300,8 @@ Content-Type: application/json | 字段 | 类型 | 说明 | 示例 | |------|------|------|------| -| `totalPlatformAgents` | integer | 已部署的平台 Agent 数量 | `1` | -| `totalCustomAgents` | integer | 已部署的自定义 Agent 数量 | `1` | +| `totalPlatformAgents` | integer | 已部署的平台 Agent 数量 | `2` | +| `totalCustomAgents` | integer | 已部署的自定义 Agent 数量 | `4` | --- @@ -322,69 +312,125 @@ Content-Type: application/json ```json { "success": true, - "message": "Agent 列表获取成功", "data": { "platformAgents": [ { - "name": "user-abc123-echo-agent-def456", + "name": "echo-agent-b00a7b8e-fa5a66", "template": "echo_agent", "templateName": "echo_agent", "status": "Running", "healthStatus": "healthy", - "podIp": "10.244.1.100", - "accessUrl": "http://user-abc123-echo-agent-def456.ai-agents.svc.cluster.local:8080", - "servicePort": 8080, + "podIp": "10.244.2.103", + "accessUrl": null, + "servicePort": null, "namespace": "ai-agents", - "hostIp": "192.168.1.10", - "nodeName": "aks-agentpool-12345678-vmss000001", "cpu": "100m", "memory": "256Mi", "replicas": 1, - "startTime": "2026-01-13T08:00:00", - "runningSeconds": 7200, - "endpoints": [ - { - "name": "http", - "port": 8080, - "protocol": "TCP", - "targetPort": 8080 - } - ] + "startTime": "2026-01-11T15:17:17.579421", + "runningSeconds": 227937, + "hostIp": null, + "nodeName": null + }, + { + "name": "echo-agent-b00a7b8e-362760", + "template": "echo_agent", + "templateName": "echo_agent", + "status": "Running", + "healthStatus": "healthy", + "podIp": "10.244.2.225", + "accessUrl": null, + "servicePort": null, + "namespace": "ai-agents", + "cpu": "100m", + "memory": "256Mi", + "replicas": 1, + "startTime": "2026-01-12T13:22:29.551127", + "runningSeconds": 148425, + "hostIp": null, + "nodeName": null } ], "customAgents": [ { - "name": "user-abc123-mysql-agent-xyz789", - "template": "mysql_agent", - "templateName": "mysql_agent", - "status": "Running", - "healthStatus": "healthy", - "podIp": "10.244.1.101", - "accessUrl": "http://user-abc123-mysql-agent-xyz789.ai-agents.svc.cluster.local:8080", - "servicePort": 8080, + "name": "test-pgsql-agent-curl", + "template": "postgresql_agent", + "templateName": "A2A", + "status": "Waiting", + "healthStatus": "degraded", + "podIp": "10.244.1.61", + "accessUrl": null, + "servicePort": null, "namespace": "ai-agents", - "hostIp": "192.168.1.11", - "nodeName": "aks-agentpool-12345678-vmss000002", - "cpu": "200m", - "memory": "512Mi", + "cpu": "100m", + "memory": "128Mi", "replicas": 1, - "startTime": "2026-01-13T09:30:00", - "runningSeconds": 1800, - "endpoints": [ - { - "name": "http", - "port": 8080, - "protocol": "TCP", - "targetPort": 8080 - } - ] + "startTime": "2026-01-13T07:32:52.290231", + "runningSeconds": 83003, + "hostIp": null, + "nodeName": null + }, + { + "name": "my-pgsql-agent", + "template": "postgresql_agent", + "templateName": "MCP", + "status": "Waiting", + "healthStatus": "degraded", + "podIp": "10.244.1.158", + "accessUrl": null, + "servicePort": null, + "namespace": "ai-agents", + "cpu": "100m", + "memory": "256Mi", + "replicas": 1, + "startTime": "2026-01-13T12:03:12.933103", + "runningSeconds": 66782, + "hostIp": null, + "nodeName": null + }, + { + "name": "test-auto-apikey-agent", + "template": "postgresql_agent", + "templateName": "MCP", + "status": "Waiting", + "healthStatus": "degraded", + "podIp": "10.244.0.43", + "accessUrl": null, + "servicePort": null, + "namespace": "ai-agents", + "cpu": "100m", + "memory": "256Mi", + "replicas": 1, + "startTime": "2026-01-13T12:10:27.145811", + "runningSeconds": 66348, + "hostIp": null, + "nodeName": null + }, + { + "name": "mysqltestagent", + "template": "mysql_agent", + "templateName": "MCP", + "status": "Waiting", + "healthStatus": "degraded", + "podIp": "10.244.2.42", + "accessUrl": null, + "servicePort": null, + "namespace": "ai-agents", + "cpu": "1000m", + "memory": "1Gi", + "replicas": 1, + "startTime": "2026-01-13T12:38:00.340200", + "runningSeconds": 64695, + "hostIp": null, + "nodeName": null } ], "summary": { - "totalPlatformAgents": 1, - "totalCustomAgents": 1 + "totalPlatformAgents": 2, + "totalCustomAgents": 4 } - } + }, + "message": "Agent 列表获取成功" } ``` @@ -393,7 +439,6 @@ Content-Type: application/json ```json { "success": true, - "message": "Agent 列表获取成功", "data": { "platformAgents": [], "customAgents": [], @@ -401,7 +446,8 @@ Content-Type: application/json "totalPlatformAgents": 0, "totalCustomAgents": 0 } - } + }, + "message": "Agent 列表获取成功" } ``` @@ -421,18 +467,11 @@ Content-Type: application/json ### Agent 访问方式 -通过 `accessUrl` 可以在集群内部访问 Agent 服务: +通过 `podIp` 可以在集群内部访问 Agent 服务: ```bash -# 在集群内部调用 Agent -curl http://user-abc123-echo-agent-def456.ai-agents.svc.cluster.local:8080/api/chat -``` - -通过 `podIp` 和 `servicePort` 也可以直接访问: - -```bash -# 直接通过 Pod IP 访问 -curl http://10.244.1.100:8080/api/chat +# 直接通过 Pod IP 访问(默认端口 8080) +curl http://10.244.2.103:8080/api/chat ``` --- @@ -444,7 +483,7 @@ curl http://10.244.1.100:8080/api/chat | LiteLLM 密钥 | PostgreSQL 数据库 | 静态(创建时存储) | | Agent 基本信息(名称、模板、CPU/内存) | PostgreSQL 数据库 | 静态(创建时存储) | | Agent 状态(status, healthStatus) | AKS 集群(通过 Agent Manager) | **实时查询** | -| Agent 网络信息(podIp, accessUrl) | AKS 集群(通过 Agent Manager) | **实时查询** | +| Agent 网络信息(podIp) | AKS 集群(通过 Agent Manager) | **实时查询** | ### 调用链路 @@ -461,4 +500,4 @@ curl http://10.244.1.100:8080/api/chat 1. **密钥安全**:返回的 `apiKey` 是完整的解密密钥,请妥善保管,不要泄露 2. **实时性**:Agent 的 `podIp`、`status` 等信息是实时从 AKS 查询的,可能有轻微延迟 3. **服务可用性**:如果 Agent Manager 服务不可用,Agent 的实时信息将显示为 `null` 或 `unknown` -4. **Pod IP 变化**:Pod 重启后 IP 地址会改变,建议使用 `accessUrl`(Service DNS)访问 +4. **Pod IP 变化**:Pod 重启后 IP 地址会改变