fix: ParseJSONDataComponent prevent unnecessary array wrapping (#4357)

* fix(ParseJSONDataComponent): prevent unnecessary array wrapping

Prevent wrapping non-array inputs in arrays to ensure correct JSON parsing and filtering.

* [autofix.ci] apply automated fixes

* updated failing test

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
bhatsanket 2024-11-11 17:38:20 -06:00 • committed by GitHub
commit 19963ded26
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 22 additions and 8 deletions

View file

@ -37,7 +37,7 @@ async def test_from_message():
ParseJSONDataComponent,
inputs={
"input_value": ComponentInputHandle(clazz=ChatInput, inputs={}, output_name="message"),
"query": ".[0].key",
"query": ".key",
},
run_input="{'key':'value1'}",
)
@ -47,7 +47,7 @@ async def test_from_message():
ParseJSONDataComponent,
inputs={
"input_value": ComponentInputHandle(clazz=ChatInput, inputs={}, output_name="message"),
"query": ".[0].key.[0].field2",
"query": ".key.[0].field2",
},
run_input='{"key":[{"field1": 1, "field2": 2}]}',
)