Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions web/app/components/base/chat/chat/__tests__/utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@ describe('chat/chat/utils.ts', () => {
expect(result.files2[0]).toHaveProperty('processed', true)
})

it('handles an empty multiFiles array without throwing', () => {
const inputs = { files1: [] }
const inputsForm = [{ variable: 'files1', type: InputVarType.multiFiles as string }]
const result = getProcessedInputs(inputs, inputsForm as InputForm[])
expect(result.files1).toEqual([])
})

it('processes jsonObject parsing correct json', () => {
const inputs = {
json1: '{"key": "value"}',
Expand Down
2 changes: 1 addition & 1 deletion web/app/components/base/chat/chat/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const getProcessedInputs = (inputs: Record<string, any>, inputsForm: Inpu
processedInputs[item.variable] = getProcessedFiles([inputValue])[0]
}
else if (item.type === InputVarType.multiFiles) {
if ('transfer_method' in inputValue[0])
if (inputValue[0] && 'transfer_method' in inputValue[0])
processedInputs[item.variable] = inputValue.map(processInputFileFromServer)
else
processedInputs[item.variable] = getProcessedFiles(inputValue)
Expand Down