fix: propagate publish release flag through Go agent endpoints (#17347)

This commit is contained in:
euvre
2026-07-30 19:27:44 +08:00
committed by GitHub
parent d87d9a2881
commit 9519ad7e08
19 changed files with 340 additions and 47 deletions

View File

@@ -291,7 +291,22 @@ func (h *AgentHandler) GetAgent(c *gin.Context) {
if row != nil {
row.DSL = dslpkg.NormalizeForCanvas(row.DSL)
}
common.SuccessWithData(c, row, "success")
// Attach last_publish_time so the front-end can render when the agent
// was last published (Python get_agent parity).
lastPublishTime, err := h.agentService.GetLastPublishTime(c.Request.Context(), canvasID)
if err != nil {
ec, em := mapAgentError(err)
common.ResponseWithCodeData(c, ec, nil, em)
return
}
common.SuccessWithData(c, &agentDetailResponse{UserCanvas: row, LastPublishTime: lastPublishTime}, "success")
}
// agentDetailResponse wraps the canvas row with derived fields that Python's
// get_agent handler adds to the response.
type agentDetailResponse struct {
*entity.UserCanvas
LastPublishTime *int64 `json:"last_publish_time,omitempty"`
}
// updateAgentRequest is the wire shape for PUT /api/v1/agents/:canvas_id.