()
| 213 | } |
| 214 | |
| 215 | func (p RequestPayload) inputItems() ([]any, error) { |
| 216 | input := gjson.GetBytes(p, reqPathInput) |
| 217 | if !input.Exists() || input.Type == gjson.Null { |
| 218 | return []any{}, nil |
| 219 | } |
| 220 | |
| 221 | if input.Type == gjson.String { |
| 222 | return []any{responses.ResponseInputItemParamOfMessage(input.String(), responses.EasyInputMessageRoleUser)}, nil |
| 223 | } |
| 224 | |
| 225 | if !input.IsArray() { |
| 226 | return nil, xerrors.Errorf("unsupported 'input' type: %s", input.Type) |
| 227 | } |
| 228 | |
| 229 | items := input.Array() |
| 230 | existing := make([]any, 0, len(items)) |
| 231 | for _, item := range items { |
| 232 | existing = append(existing, json.RawMessage(item.Raw)) |
| 233 | } |
| 234 | |
| 235 | return existing, nil |
| 236 | } |
| 237 | |
| 238 | func (p RequestPayload) toolItems() ([]json.RawMessage, error) { |
| 239 | tools := gjson.GetBytes(p, reqPathTools) |
no test coverage detected