Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Feat: The key for the begin operator can only contain alphanumeric characters and underscores. #10427 (#11377)

balibabudb5ec89dc5e3
diff --git a/web/src/components/icon-font.tsx b/web/src/components/icon-font.tsx
index 7c6436d900..7dde93f648 100644
--- a/web/src/components/icon-font.tsx
+++ b/web/src/components/icon-font.tsx
@@ -1,15 +1,16 @@
import { FileIconMap } from '@/constants/file';
import { cn } from '@/lib/utils';
import { getExtension } from '@/utils/document-util';
+import { CSSProperties } from 'react';
type IconFontType = {
name: string;
-
className?: string;
+ style?: CSSProperties;
};
-export const IconFont = ({ name, className }: IconFontType) => (
- <svg className={cn('size-4', className)}>
+export const IconFont = ({ name, className, style }: IconFontType) => (
+ <svg className={cn('size-4', className)} style={style}>
<use xlinkHref={`#icon-${name}`} />
</svg>
);
diff --git a/web/src/components/key-input.tsx b/web/src/components/key-input.tsx
index 4c6c2f8228..788e4cfe3a 100644
--- a/web/src/components/key-input.tsx
+++ b/web/src/components/key-input.tsx
@@ -8,7 +8,10 @@ type KeyInputProps = {
} & Omit<InputProps, 'onChange'>;
export const KeyInput = forwardRef<HTMLInputElement, KeyInputProps>(
- function KeyInput({ value, onChange, searchValue = /[^a-zA-Z0-9_]/g }, ref) {
+ function KeyInput(
+ { value, onChange, searchValue = /[^a-zA-Z0-9_]/g, ...props },
+ ref,
+ ) {
const handleChange = useCallback(
(e: ChangeEvent<HTMLInputElement>) => {
const value = e.target.value ?? '';
@@ -18,6 +21,6 @@ export const KeyInput = forwardRef<HTMLInputElement, KeyInputProps>(
[onChange, searchValue],
);
- return <Input value={value} onChange={handleChange} ref={ref} />;
+ return <Input {...props} value={value} onChange={handleChange} ref={ref} />;
},
);
diff --git a/web/src/hooks/logic-hooks/use-build-operator-options.tsx b/web/src/hooks/logic-hooks/use-build-operator-options.tsx
index f1d2f3619c..6576cb4f55 100644
--- a/web/src/hooks/logic-hooks/use-build-operator-options.tsx
+++ b/web/src/hooks/logic-hooks/use-build-operator-options.tsx
@@ -12,9 +12,12 @@ export const LogicalOperatorIcon = function OperatorIcon({
return (
<IconFont
name={icon}
- className={cn('size-4', {
- 'rotate-180': value === ComparisonOperator.GreatThan,
- })}
+ className={cn('size-4')}
+ style={
+ value === ComparisonOperator.GreatThan
+ ? { transform: 'rotate(180deg)' }
+ : undefined
+ }
></IconFont>
);
}
diff --git a/web/src/pages/agent/constant/index.tsx b/web/src/pages/agent/constant/index.tsx
index d10026887d..c357e8cb79 100644
--- a/web/src/pages/agent/constant/index.tsx
+++ b/web/src/pages/agent/constant/index.tsx
@@ -868,7 +868,7 @@ export enum VariableAssignerLogicalArrayOperator {
}
export enum ExportFileType {
- PDF = 'pdf',
+ // PDF = 'pdf',
HTML = 'html',
Markdown = 'md',
DOCX = 'docx',
diff --git a/web/src/pages/agent/form/begin-form/parameter-dialog.tsx b/web/src/pages/agent/form/begin-form/parameter-dialog.tsx
index 3b90704379..88f239a4e7 100644
--- a/web/src/pages/agent/form/begin-form/parameter-dialog.tsx
+++ b/web/src/pages/agent/form/begin-form/parameter-dialog.tsx
@@ -1,3 +1,4 @@
+import { KeyInput } from '@/components/key-input';
import { Button } from '@/components/ui/button';
import {
Dialog,
@@ -113,7 +114,6 @@ function ParameterForm({
function onSubmit(data: z.infer<typeof FormSchema>) {
const values = { ...data, options: data.options?.map((x) => x.value) };
- console.log('🚀 ~ onSubmit ~ values:', values);
submit(values);
}
@@ -153,7 +153,11 @@ function ParameterForm({
<FormItem>
<FormLabel>{t('key')}</FormLabel>
<FormControl>
- <Input {...field} autoComplete="off" onBlur={handleKeyChange} />
+ <KeyInput
+ {...field}
+ autoComplete="off"
+ onBlur={handleKeyChange}
+ />
</FormControl>
<FormMessage />
</FormItem>
diff --git a/web/src/pages/agent/form/iteration-form/dynamic-output.tsx b/web/src/pages/agent/form/iteration-form/dynamic-output.tsx
index c31be8fd06..2bc4ab6f45 100644
--- a/web/src/pages/agent/form/iteration-form/dynamic-output.tsx
+++ b/web/src/pages/agent/form/iteration-form/dynamic-output.tsx
@@ -1,6 +1,7 @@
'use client';
import { FormContainer } from '@/components/form-container';
+import { KeyInput } from '@/components/key-input';
import { SelectWithSearch } from '@/components/originui/select-with-search';
import { BlockButton, Button } from '@/components/ui/button';
import {
@@ -9,7 +10,6 @@ import {
FormItem,
FormMessage,
} from '@/components/ui/form';
-import { Input } from '@/components/ui/input';
import { Separator } from '@/components/ui/separator';
import { RAGFlowNodeType } from '@/interfaces/database/flow';
import { t } from 'i18next';
@@ -67,10 +67,10 @@ export function DynamicOutputForm({ node }: IProps) {
render={({ field }) => (
<FormItem className="flex-1">
<FormControl>
- <Input
+ <KeyInput
{...field}
placeholder={t('common.pleaseInput')}
- ></Input>
+ ></KeyInput>
</FormControl>
<FormMessage />
</FormItem>