feat(captain): align scenario and tool payloads

This commit is contained in:
2026-06-05 12:05:53 +08:00
parent 41a1b0c47e
commit fc2cb12e63
13 changed files with 588 additions and 107 deletions
@@ -347,11 +347,15 @@ func (h *CaptainAssistantHandler) GenerateResponse(c *gin.Context) {
}
func bindCaptainAssistantPayload(c *gin.Context, dst any) error {
return bindNestedJSONPayload(c, "assistant", dst)
}
func bindNestedJSONPayload(c *gin.Context, key string, dst any) error {
var raw map[string]json.RawMessage
if err := c.ShouldBindJSON(&raw); err != nil {
return err
}
if nested, ok := raw["assistant"]; ok {
if nested, ok := raw[key]; ok {
return json.Unmarshal(nested, dst)
}
body, err := json.Marshal(raw)