feat(data-source): add LOCAL_FILE_OUTPUT to constants and integrate into panel for local file handling

This commit is contained in:
twwu 2025-08-21 14:17:25 +08:00
parent cecef01bf7
commit 60fafc524c
2 changed files with 16 additions and 91 deletions

View File

@ -79,94 +79,3 @@ export const LOCAL_FILE_OUTPUT = [
],
},
]
export const WEBSITE_CRAWL_OUTPUT = [
{
name: 'source_url',
type: VarType.string,
description: 'The URL of the crawled website',
},
{
name: 'content',
type: VarType.string,
description: 'The content of the crawled website',
},
{
name: 'title',
type: VarType.string,
description: 'The title of the crawled website',
},
{
name: 'description',
type: VarType.string,
description: 'The description of the crawled website',
},
]
export const ONLINE_DOCUMENT_OUTPUT = [
{
name: 'workspace_id',
type: VarType.string,
description: 'The ID of the workspace where the document is stored',
},
{
name: 'page_id',
type: VarType.string,
description: 'The ID of the page in the document',
},
{
name: 'content',
type: VarType.string,
description: 'The content of the online document',
},
]
export const ONLINE_DRIVE_OUTPUT = [
{
name: 'file',
type: VarType.file,
description: 'file',
subItems: [
{
name: 'name',
type: VarType.string,
description: '',
},
{
name: 'size',
type: VarType.number,
description: '',
},
{
name: 'type',
type: VarType.string,
description: '',
},
{
name: 'extension',
type: VarType.string,
description: '',
},
{
name: 'mime_type',
type: VarType.string,
description: '',
},
{
name: 'transfer_method',
type: VarType.string,
description: '',
},
{
name: 'url',
type: VarType.string,
description: '',
},
{
name: 'related_id',
type: VarType.string,
description: '',
},
],
},
]

View File

@ -17,6 +17,7 @@ import { useNodesReadOnly } from '@/app/components/workflow/hooks'
import { useConfig } from './hooks/use-config'
import {
COMMON_OUTPUT,
LOCAL_FILE_OUTPUT,
} from './constants'
import { useStore } from '@/app/components/workflow/store'
import { toolParametersToFormSchemas } from '@/app/components/tools/utils/to-form-schema'
@ -117,6 +118,21 @@ const Panel: FC<NodePanelProps<DataSourceNodeType>> = ({ id, data }) => {
/>
))
}
{
isLocalFile && LOCAL_FILE_OUTPUT.map((item, index) => (
<VarItem
key={index}
name={item.name}
type={item.type}
description={item.description}
subItems={item.subItems.map(item => ({
name: item.name,
type: item.type,
description: item.description,
}))}
/>
))
}
{
outputSchema.map(outputItem => (
<div key={outputItem.name}>