RegisterRoutes 注册 A2A 路由到 Gin RouterGroup
(rg *gin.RouterGroup)
| 300 | |
| 301 | // RegisterRoutes 注册 A2A 路由到 Gin RouterGroup |
| 302 | func (h *Handler) RegisterRoutes(rg *gin.RouterGroup) { |
| 303 | // Agent Card 端点 (符合 A2A 规范的路径) |
| 304 | rg.GET("/.well-known/:agentId/agent-card.json", h.GetAgentCard) |
| 305 | |
| 306 | // A2A JSON-RPC 端点 |
| 307 | a2a := rg.Group("/a2a") |
| 308 | { |
| 309 | // 单个 JSON-RPC 请求 |
| 310 | a2a.POST("/:agentId", h.HandleJSONRPC) |
| 311 | |
| 312 | // 批量 JSON-RPC 请求 |
| 313 | a2a.POST("/:agentId/batch", h.HandleBatchJSONRPC) |
| 314 | |
| 315 | // 便捷端点:直接获取任务状态 |
| 316 | a2a.GET("/:agentId/tasks/:taskId", h.GetTaskStatus) |
| 317 | } |
| 318 | } |