diff --git a/web/app/components/base/file-uploader/utils.ts b/web/app/components/base/file-uploader/utils.ts index e05c0b2087..2b557d82a3 100644 --- a/web/app/components/base/file-uploader/utils.ts +++ b/web/app/components/base/file-uploader/utils.ts @@ -135,7 +135,7 @@ export const getProcessedFilesFromResponse = (files: FileResponse[]) => { transferMethod: fileItem.transfer_method, supportFileType: fileItem.type, uploadedId: fileItem.upload_file_id || fileItem.related_id, - url: fileItem.url, + url: fileItem.url || fileItem.remote_url, } }) } diff --git a/web/app/components/workflow/variable-inspect/value-content.tsx b/web/app/components/workflow/variable-inspect/value-content.tsx index e8abae968e..5fad36efef 100644 --- a/web/app/components/workflow/variable-inspect/value-content.tsx +++ b/web/app/components/workflow/variable-inspect/value-content.tsx @@ -13,7 +13,7 @@ import { validateJSONSchema, } from '@/app/components/workflow/variable-inspect/utils' import { useFeatures } from '@/app/components/base/features/hooks' -import { getProcessedFiles } from '@/app/components/base/file-uploader/utils' +import { getProcessedFiles, getProcessedFilesFromResponse } from '@/app/components/base/file-uploader/utils' import { JSON_SCHEMA_MAX_DEPTH } from '@/config' import { TransferMethod } from '@/types/app' import { FILE_EXTS } from '@/app/components/base/prompt-editor/constants' @@ -47,9 +47,9 @@ const ValueContent = ({ const fileFeature = useFeatures(s => s.features.file) const [fileValue, setFileValue] = useState( currentVar.value_type === 'array[file]' - ? currentVar.value || [] + ? getProcessedFilesFromResponse(currentVar.value || []) : currentVar.value - ? [currentVar.value] + ? getProcessedFilesFromResponse([currentVar.value]) : [], ) @@ -68,11 +68,12 @@ const ValueContent = ({ setJson(currentVar.value ? JSON.stringify(currentVar.value, null, 2) : '') if (showFileEditor) { + console.log(getProcessedFilesFromResponse(currentVar.value || [])) setFileValue( (currentVar.value_type === 'array[file]' || isSysFiles) - ? currentVar.value || [] + ? getProcessedFilesFromResponse(currentVar.value || []) : currentVar.value - ? [currentVar.value] + ? getProcessedFilesFromResponse([currentVar.value]) : [], ) } diff --git a/web/types/workflow.ts b/web/types/workflow.ts index a799ac014a..0f20656cbf 100644 --- a/web/types/workflow.ts +++ b/web/types/workflow.ts @@ -201,6 +201,7 @@ export type FileResponse = { type: string url: string upload_file_id: string + remote_url: string } export type NodeFinishedResponse = {