From f218b23fb7c201155f9c1999bb00e9d39c077426 Mon Sep 17 00:00:00 2001 From: Joel Date: Wed, 11 Jun 2025 18:30:30 +0800 Subject: [PATCH] chore: add sys files detect --- .../workflow/variable-inspect/value-content.tsx | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/web/app/components/workflow/variable-inspect/value-content.tsx b/web/app/components/workflow/variable-inspect/value-content.tsx index 3987d348c4..e8abae968e 100644 --- a/web/app/components/workflow/variable-inspect/value-content.tsx +++ b/web/app/components/workflow/variable-inspect/value-content.tsx @@ -35,9 +35,10 @@ const ValueContent = ({ const errorMessageRef = useRef(null) const [editorHeight, setEditorHeight] = useState(0) const showTextEditor = currentVar.value_type === 'secret' || currentVar.value_type === 'string' || currentVar.value_type === 'number' - const showJSONEditor = currentVar.value_type === 'object' || currentVar.value_type === 'array[string]' || currentVar.value_type === 'array[number]' || currentVar.value_type === 'array[object]' - const showFileEditor = currentVar.value_type === 'file' || currentVar.value_type === 'array[file]' - const textEditorDisabled = currentVar.type === VarInInspectType.environment || (currentVar.type === VarInInspectType.system && currentVar.name !== 'query') + const isSysFiles = currentVar.type === VarInInspectType.system && currentVar.name === 'files' + const showJSONEditor = !isSysFiles && (currentVar.value_type === 'object' || currentVar.value_type === 'array[string]' || currentVar.value_type === 'array[number]' || currentVar.value_type === 'array[object]') + const showFileEditor = isSysFiles || currentVar.value_type === 'file' || currentVar.value_type === 'array[file]' + const textEditorDisabled = currentVar.type === VarInInspectType.environment || (currentVar.type === VarInInspectType.system && currentVar.name !== 'query' && currentVar.name !== 'files') const [value, setValue] = useState() const [json, setJson] = useState('') @@ -67,12 +68,15 @@ const ValueContent = ({ setJson(currentVar.value ? JSON.stringify(currentVar.value, null, 2) : '') if (showFileEditor) { - setFileValue(currentVar.value_type === 'array[file]' + setFileValue( + (currentVar.value_type === 'array[file]' || isSysFiles) ? currentVar.value || [] : currentVar.value ? [currentVar.value] - : []) + : [], + ) } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [currentVar.id, currentVar.value]) const handleTextChange = (value: string) => { @@ -141,7 +145,7 @@ const ValueContent = ({ return if (currentVar.value_type === 'file') debounceValueChange(currentVar.id, value[0]) - if (currentVar.value_type === 'array[file]') + if (currentVar.value_type === 'array[file]' || isSysFiles) debounceValueChange(currentVar.id, value) }