feat: Add ONLINE_DRIVE_OUTPUT and integrate into DataSource components for online drive support

This commit is contained in:
twwu 2025-07-04 18:04:47 +08:00
parent e67a19b26b
commit 0d9991ec88
4 changed files with 70 additions and 0 deletions

View File

@ -120,3 +120,53 @@ export const ONLINE_DOCUMENT_OUTPUT = [
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

@ -7,6 +7,7 @@ import {
COMMON_OUTPUT,
LOCAL_FILE_OUTPUT,
ONLINE_DOCUMENT_OUTPUT,
ONLINE_DRIVE_OUTPUT,
WEBSITE_CRAWL_OUTPUT,
} from './constants'
import { VarType as VarKindType } from '@/app/components/workflow/nodes/tool/types'
@ -62,6 +63,7 @@ const nodeDefault: NodeDefault<DataSourceNodeType> = {
const isLocalFile = provider_type === DataSourceClassification.localFile
const isWebsiteCrawl = provider_type === DataSourceClassification.websiteCrawl
const isOnlineDocument = provider_type === DataSourceClassification.onlineDocument
const isOnlineDrive = provider_type === DataSourceClassification.onlineDrive
return [
...COMMON_OUTPUT.map(item => ({ variable: item.name, type: item.type })),
...(
@ -79,6 +81,11 @@ const nodeDefault: NodeDefault<DataSourceNodeType> = {
? ONLINE_DOCUMENT_OUTPUT.map(item => ({ variable: item.name, type: item.type }))
: []
),
...(
isOnlineDrive
? ONLINE_DRIVE_OUTPUT.map(item => ({ variable: item.name, type: item.type }))
: []
),
...ragVars,
]
},

View File

@ -22,6 +22,7 @@ import {
COMMON_OUTPUT,
LOCAL_FILE_OUTPUT,
ONLINE_DOCUMENT_OUTPUT,
ONLINE_DRIVE_OUTPUT,
WEBSITE_CRAWL_OUTPUT,
} from './constants'
import { useStore } from '@/app/components/workflow/store'
@ -52,6 +53,7 @@ const Panel: FC<NodePanelProps<DataSourceNodeType>> = ({ id, data }) => {
const isLocalFile = provider_type === DataSourceClassification.localFile
const isWebsiteCrawl = provider_type === DataSourceClassification.websiteCrawl
const isOnlineDocument = provider_type === DataSourceClassification.onlineDocument
const isOnlineDrive = provider_type === DataSourceClassification.onlineDrive
const currentDataSource = dataSourceList?.find(ds => ds.plugin_id === plugin_id)
const isAuthorized = !!currentDataSource?.is_authorized
const [showAuthModal, {
@ -204,6 +206,16 @@ const Panel: FC<NodePanelProps<DataSourceNodeType>> = ({ id, data }) => {
/>
))
}
{
isOnlineDrive && ONLINE_DRIVE_OUTPUT.map((item, index) => (
<VarItem
key={index}
name={item.name}
type={item.type}
description={item.description}
/>
))
}
</OutputVars>
{
showAuthModal && !isLocalFile && (

View File

@ -10,6 +10,7 @@ export enum DataSourceClassification {
localFile = 'local_file',
websiteCrawl = 'website_crawl',
onlineDocument = 'online_document',
onlineDrive = 'online_drive',
}
export type ToolVarInputs = Record<string, {