diff --git a/web/src/components/originui/select-with-search.tsx b/web/src/components/originui/select-with-search.tsx
index 0362d3e35..dba2bedc3 100644
--- a/web/src/components/originui/select-with-search.tsx
+++ b/web/src/components/originui/select-with-search.tsx
@@ -31,7 +31,7 @@ import { RAGFlowSelectOptionType } from '../ui/select';
export type SelectWithSearchFlagOptionType = {
label: string;
value?: string;
- options: RAGFlowSelectOptionType[];
+ options?: RAGFlowSelectOptionType[];
};
export type SelectWithSearchFlagProps = {
@@ -64,7 +64,9 @@ export const SelectWithSearch = forwardRef<
const selectLabel = useMemo(() => {
const optionTemp = options[0];
if (optionTemp?.options) {
- return optionTemp.options.find((opt) => opt.value === value)?.label || '';
+ return options
+ .map((group) => group?.options?.find((item) => item.value === value))
+ .filter(Boolean)[0]?.label;
} else {
return options.find((opt) => opt.value === value)?.label || '';
}
diff --git a/web/src/pages/agent/canvas/node/dropdown/next-step-dropdown.tsx b/web/src/pages/agent/canvas/node/dropdown/next-step-dropdown.tsx
index 4acc9c746..c2b2996b8 100644
--- a/web/src/pages/agent/canvas/node/dropdown/next-step-dropdown.tsx
+++ b/web/src/pages/agent/canvas/node/dropdown/next-step-dropdown.tsx
@@ -98,7 +98,7 @@ function AccordionOperators() {
Tools
diff --git a/web/src/pages/agent/constant.tsx b/web/src/pages/agent/constant.tsx
index effbe240c..8e8bb2d68 100644
--- a/web/src/pages/agent/constant.tsx
+++ b/web/src/pages/agent/constant.tsx
@@ -622,7 +622,7 @@ export const initialNoteValues = {
export const initialCrawlerValues = {
extract_type: 'markdown',
- ...initialQueryBaseValues,
+ query: '',
};
export const initialInvokeValues = {
diff --git a/web/src/pages/agent/form/crawler-form/index.tsx b/web/src/pages/agent/form/crawler-form/index.tsx
index 5dd75d0ac..4a4c729cd 100644
--- a/web/src/pages/agent/form/crawler-form/index.tsx
+++ b/web/src/pages/agent/form/crawler-form/index.tsx
@@ -1,38 +1,84 @@
+import { SelectWithSearch } from '@/components/originui/select-with-search';
+import {
+ Form,
+ FormControl,
+ FormField,
+ FormItem,
+ FormLabel,
+ FormMessage,
+} from '@/components/ui/form';
+import { Input } from '@/components/ui/input';
import { useTranslate } from '@/hooks/common-hooks';
-import { Form, Input, Select } from 'antd';
+import { zodResolver } from '@hookform/resolvers/zod';
import { useMemo } from 'react';
-import { IOperatorForm } from '../../interface';
+import { useForm } from 'react-hook-form';
+import { z } from 'zod';
+import { initialCrawlerValues } from '../../constant';
+import { useWatchFormChange } from '../../hooks/use-watch-form-change';
+import { INextOperatorForm } from '../../interface';
import { CrawlerResultOptions } from '../../options';
-import DynamicInputVariable from '../components/dynamic-input-variable';
-const CrawlerForm = ({ onValuesChange, form, node }: IOperatorForm) => {
+import { QueryVariable } from '../components/query-variable';
+
+const FormSchema = z.object({
+ query: z.string().optional(),
+ proxy: z.string().url(),
+ extract_type: z.string(),
+});
+function CrawlerForm({ node }: INextOperatorForm) {
const { t } = useTranslate('flow');
+ const form = useForm>({
+ resolver: zodResolver(FormSchema),
+ defaultValues: initialCrawlerValues,
+ mode: 'onChange',
+ });
+
+ useWatchFormChange(node?.id, form);
+
const crawlerResultOptions = useMemo(() => {
return CrawlerResultOptions.map((x) => ({
value: x,
label: t(`crawlerResultOptions.${x}`),
}));
}, [t]);
+
return (
-
-
-
-
+
+
+ (
+
+ {t('proxy')}
+
+
+
+
+
+ )}
+ />
+ (
+
+ {t('extractType')}
+
+
+
+
+
+ )}
+ />
+
);
-};
+}
export default CrawlerForm;
diff --git a/web/src/pages/agent/hooks/use-watch-form-change.ts b/web/src/pages/agent/hooks/use-watch-form-change.ts
index f12b869fd..534c2e2a9 100644
--- a/web/src/pages/agent/hooks/use-watch-form-change.ts
+++ b/web/src/pages/agent/hooks/use-watch-form-change.ts
@@ -2,14 +2,14 @@ import { useEffect } from 'react';
import { UseFormReturn, useWatch } from 'react-hook-form';
import useGraphStore from '../store';
-export function useWatchFormChange(id?: string, form?: UseFormReturn) {
+export function useWatchFormChange(id?: string, form?: UseFormReturn) {
let values = useWatch({ control: form?.control });
const updateNodeForm = useGraphStore((state) => state.updateNodeForm);
useEffect(() => {
// Manually triggered form updates are synchronized to the canvas
- if (id && form?.formState.isDirty) {
- values = form?.getValues();
+ if (id) {
+ values = form?.getValues() || {};
let nextValues: any = values;
updateNodeForm(id, nextValues);