diff --git a/web/components/flow/node-renderer/input.tsx b/web/components/flow/node-renderer/input.tsx
index 60c559baa..436899fc1 100644
--- a/web/components/flow/node-renderer/input.tsx
+++ b/web/components/flow/node-renderer/input.tsx
@@ -1,6 +1,8 @@
import { IFlowNodeParameter } from '@/types/flow';
import { convertKeysToCamelCase } from '@/utils/flow';
import { Input } from 'antd';
+import * as Icons from '@ant-design/icons';
+import { FC } from 'react';
type Props = {
data: IFlowNodeParameter;
@@ -8,9 +10,27 @@ type Props = {
onChange: (value: any) => void;
};
+const isValidIconComponent = (component: any): component is FC => {
+ console.log('222', typeof component);
+
+ return component && typeof component === 'function';
+};
+
+const getIconComponent = (iconString: string) => {
+ const match = iconString.match(/^icon:(\w+)$/);
+ if (match) {
+ const iconName = match[1] as keyof typeof Icons;
+ const IconComponent = Icons[iconName];
+ // @ts-ignore
+ return IconComponent ? : null;
+ }
+ return null;
+};
+
export const RenderInput = (params: Props) => {
const { data, defaultValue, onChange } = params;
const attr = convertKeysToCamelCase(data.ui?.attr || {});
+ attr.prefix = getIconComponent(data.ui?.attr?.prefix || '');
return (