diff --git a/web/app/components/rag-pipeline/components/input-field/editor/index.tsx b/web/app/components/rag-pipeline/components/input-field/editor/index.tsx index 77882f0259..7caca68c68 100644 --- a/web/app/components/rag-pipeline/components/input-field/editor/index.tsx +++ b/web/app/components/rag-pipeline/components/input-field/editor/index.tsx @@ -1,7 +1,7 @@ import { RiCloseLine } from '@remixicon/react' import DialogWrapper from './dialog-wrapper' import InputFieldForm from './form' -import { convertToInputFieldFormData } from './utils' +import { convertFormDataToINputField, convertToInputFieldFormData } from './utils' import { useCallback } from 'react' import { useTranslation } from 'react-i18next' import type { InputVar } from '@/models/pipeline' @@ -24,35 +24,8 @@ const InputFieldEditor = ({ const formData = convertToInputFieldFormData(initialData) const handleSubmit = useCallback((value: FormData) => { - const { - type, - label, - variable, - maxLength, - required, - tooltips, - options, - placeholder, - unit, - default: defaultValue, - allowedFileUploadMethods, - allowedTypesAndExtensions, - } = value - onSubmit({ - type, - label, - variable, - max_length: maxLength, - required, - tooltips, - options, - placeholder, - unit, - default_value: defaultValue, - allowed_file_upload_methods: allowedFileUploadMethods, - allowed_file_types: allowedTypesAndExtensions.allowedFileTypes, - allowed_file_extensions: allowedTypesAndExtensions.allowedFileExtensions, - }) + const inputFieldData = convertFormDataToINputField(value) + onSubmit(inputFieldData) onClose() }, [onSubmit, onClose]) diff --git a/web/app/components/rag-pipeline/components/input-field/editor/utils.ts b/web/app/components/rag-pipeline/components/input-field/editor/utils.ts index f9c2d143dd..9f8aba3ecf 100644 --- a/web/app/components/rag-pipeline/components/input-field/editor/utils.ts +++ b/web/app/components/rag-pipeline/components/input-field/editor/utils.ts @@ -43,3 +43,36 @@ export const convertToInputFieldFormData = (data?: InputVar): FormData => { }, } } + +export const convertFormDataToINputField = (data: FormData): InputVar => { + const { + type, + label, + variable, + maxLength, + default: defaultValue, + required, + tooltips, + options, + placeholder, + unit, + allowedFileUploadMethods, + allowedTypesAndExtensions: { allowedFileTypes, allowedFileExtensions }, + } = data + + return { + type, + label, + variable, + max_length: maxLength, + default_value: defaultValue, + required, + tooltips, + options, + placeholder, + unit, + allowed_file_upload_methods: allowedFileUploadMethods, + allowed_file_types: allowedFileTypes, + allowed_file_extensions: allowedFileExtensions, + } +} diff --git a/web/app/components/rag-pipeline/components/input-field/label-right-content/datasource.tsx b/web/app/components/rag-pipeline/components/input-field/label-right-content/datasource.tsx index 1a21f6d68f..e35388c5d1 100644 --- a/web/app/components/rag-pipeline/components/input-field/label-right-content/datasource.tsx +++ b/web/app/components/rag-pipeline/components/input-field/label-right-content/datasource.tsx @@ -1,6 +1,8 @@ import React from 'react' -import { RiDatabase2Fill } from '@remixicon/react' import type { DataSourceNodeType } from '@/app/components/workflow/nodes/data-source/types' +import { useToolIcon } from '@/app/components/workflow/hooks' +import BlockIcon from '@/app/components/workflow/block-icon' +import { BlockEnum } from '@/app/components/workflow/types' type DatasourceProps = { nodeData: DataSourceNodeType @@ -9,10 +11,16 @@ type DatasourceProps = { const Datasource = ({ nodeData, }: DatasourceProps) => { + const toolIcon = useToolIcon(nodeData) + return (
- +
{nodeData.title}
diff --git a/web/app/components/rag-pipeline/components/panel/test-run/consts.ts b/web/app/components/rag-pipeline/components/panel/test-run/consts.ts deleted file mode 100644 index 390b9e0e61..0000000000 --- a/web/app/components/rag-pipeline/components/panel/test-run/consts.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type { CrawlOptions } from '@/models/datasets' - -export const DEFAULT_CRAWL_OPTIONS: CrawlOptions = { - crawl_sub_pages: true, - only_main_content: true, - includes: '', - excludes: '', - limit: 10, - max_depth: '', - use_sitemap: true, -}