feat(captain): align scenario and tool payloads
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user