Skip to content

Commit

Permalink
Fix: compatible with outputs data structure (#11432)
Browse files Browse the repository at this point in the history
  • Loading branch information
JzoNgKVO authored and iamjoel committed Dec 16, 2024
1 parent 898ea9b commit ffd1343
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions web/app/components/base/file-uploader/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,13 @@ export const isAllowedFileExtension = (fileName: string, fileMimetype: string, a

export const getFilesInLogs = (rawData: any) => {
const result = Object.keys(rawData || {}).map((key) => {
if (typeof rawData[key] === 'object' && rawData[key].dify_model_identity === '__dify__file__') {
if (typeof rawData[key] === 'object' && rawData[key]?.dify_model_identity === '__dify__file__') {
return {
varName: key,
list: getProcessedFilesFromResponse([rawData[key]]),
}
}
if (Array.isArray(rawData[key]) && rawData[key].some(item => item.dify_model_identity === '__dify__file__')) {
if (Array.isArray(rawData[key]) && rawData[key].some(item => item?.dify_model_identity === '__dify__file__')) {
return {
varName: key,
list: getProcessedFilesFromResponse(rawData[key]),
Expand Down
4 changes: 2 additions & 2 deletions web/app/components/workflow/run/output-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ const OutputPanel: FC<OutputPanelProps> = ({
for (const key in outputs) {
if (Array.isArray(outputs[key])) {
outputs[key].map((output: any) => {
if (output.dify_model_identity === '__dify__file__')
if (output?.dify_model_identity === '__dify__file__')
fileList.push(output)
return null
})
}
else if (outputs[key].dify_model_identity === '__dify__file__') {
else if (outputs[key]?.dify_model_identity === '__dify__file__') {
fileList.push(outputs[key])
}
}
Expand Down

0 comments on commit ffd1343

Please sign in to comment.