Commit 4275de96 by Archer Committed by GitHub

Revert "compatible with old enums (#5219)" (#5222)

This reverts commit f000fbb1.
parent d102adca
...@@ -341,13 +341,7 @@ export const toolSetData2FlowNodeIO = ({ ...@@ -341,13 +341,7 @@ export const toolSetData2FlowNodeIO = ({
}; };
export const formatEditorVariablePickerIcon = ( export const formatEditorVariablePickerIcon = (
variables: { variables: { key: string; label: string; type?: `${VariableInputEnum}`; required?: boolean }[]
id: string;
key: string;
label: string;
type?: `${VariableInputEnum}`;
required?: boolean;
}[]
): EditorVariablePickerType[] => { ): EditorVariablePickerType[] => {
return variables.map((item) => ({ return variables.map((item) => ({
...item, ...item,
......
import type { WorkflowIOValueTypeEnum } from '@fastgpt/global/core/workflow/constants'; import type { WorkflowIOValueTypeEnum } from '@fastgpt/global/core/workflow/constants';
export type EditorVariablePickerType = { export type EditorVariablePickerType = {
id: string;
key: string; key: string;
label: string; label: string;
required?: boolean; required?: boolean;
......
...@@ -385,7 +385,7 @@ const TableItem = ({ ...@@ -385,7 +385,7 @@ const TableItem = ({
onClick={() => { onClick={() => {
const formattedItem = { const formattedItem = {
...item, ...item,
list: item.enums?.map((item) => ({ label: item.value, value: item.value })) || [] list: item.enums || []
}; };
reset(formattedItem); reset(formattedItem);
}} }}
......
...@@ -100,14 +100,11 @@ const InputRender = (props: InputRenderProps) => { ...@@ -100,14 +100,11 @@ const InputRender = (props: InputRenderProps) => {
} }
if (inputType === InputTypeEnum.select) { if (inputType === InputTypeEnum.select) {
const list = return <MySelect {...commonProps} list={props.list || []} h={10} />;
props.list || props.enums?.map((item) => ({ label: item.value, value: item.value })) || [];
return <MySelect {...commonProps} list={list} h={10} />;
} }
if (inputType === InputTypeEnum.multipleSelect) { if (inputType === InputTypeEnum.multipleSelect) {
const list = const { list = [] } = props;
props.list || props.enums?.map((item) => ({ label: item.value, value: item.value })) || [];
return ( return (
<MultipleSelect<string> <MultipleSelect<string>
{...commonProps} {...commonProps}
......
...@@ -40,9 +40,6 @@ type SpecificProps = ...@@ -40,9 +40,6 @@ type SpecificProps =
// select & multipleSelect // select & multipleSelect
inputType: InputTypeEnum.select | InputTypeEnum.multipleSelect; inputType: InputTypeEnum.select | InputTypeEnum.multipleSelect;
list?: { label: string; value: string }[]; list?: { label: string; value: string }[];
// old version
enums?: { value: string }[];
} }
| { | {
// JSONEditor // JSONEditor
......
...@@ -174,7 +174,6 @@ const RenderHttpMethodAndUrl = React.memo(function RenderHttpMethodAndUrl({ ...@@ -174,7 +174,6 @@ const RenderHttpMethodAndUrl = React.memo(function RenderHttpMethodAndUrl({
return ( return (
feConfigs?.externalProviderWorkflowVariables?.map((item) => ({ feConfigs?.externalProviderWorkflowVariables?.map((item) => ({
key: item.key, key: item.key,
id: item.key,
label: item.name label: item.name
})) || [] })) || []
); );
...@@ -295,7 +294,6 @@ export function RenderHttpProps({ ...@@ -295,7 +294,6 @@ export function RenderHttpProps({
return ( return (
feConfigs?.externalProviderWorkflowVariables?.map((item) => ({ feConfigs?.externalProviderWorkflowVariables?.map((item) => ({
key: item.key, key: item.key,
id: item.key,
label: item.name label: item.name
})) || [] })) || []
); );
...@@ -500,7 +498,6 @@ const RenderForm = ({ ...@@ -500,7 +498,6 @@ const RenderForm = ({
input: FlowNodeInputItemType; input: FlowNodeInputItemType;
variables: EditorVariableLabelPickerType[]; variables: EditorVariableLabelPickerType[];
externalProviderWorkflowVariables: { externalProviderWorkflowVariables: {
id: string;
key: string; key: string;
label: string; label: string;
}[]; }[];
...@@ -687,7 +684,6 @@ const RenderBody = ({ ...@@ -687,7 +684,6 @@ const RenderBody = ({
typeInput: FlowNodeInputItemType | undefined; typeInput: FlowNodeInputItemType | undefined;
variables: EditorVariableLabelPickerType[]; variables: EditorVariableLabelPickerType[];
externalProviderWorkflowVariables: { externalProviderWorkflowVariables: {
id: string;
key: string; key: string;
label: string; label: string;
}[]; }[];
......
...@@ -67,7 +67,6 @@ const NodeVariableUpdate = ({ data, selected }: NodeProps<FlowNodeItemType>) => ...@@ -67,7 +67,6 @@ const NodeVariableUpdate = ({ data, selected }: NodeProps<FlowNodeItemType>) =>
const externalProviderWorkflowVariables = useMemo(() => { const externalProviderWorkflowVariables = useMemo(() => {
return ( return (
feConfigs?.externalProviderWorkflowVariables?.map((item) => ({ feConfigs?.externalProviderWorkflowVariables?.map((item) => ({
id: item.key,
key: item.key, key: item.key,
label: item.name label: item.name
})) || [] })) || []
......
...@@ -51,7 +51,6 @@ const CommonInputForm = ({ item, nodeId }: RenderInputProps) => { ...@@ -51,7 +51,6 @@ const CommonInputForm = ({ item, nodeId }: RenderInputProps) => {
const externalVariables = useMemo(() => { const externalVariables = useMemo(() => {
return ( return (
feConfigs?.externalProviderWorkflowVariables?.map((item) => ({ feConfigs?.externalProviderWorkflowVariables?.map((item) => ({
id: item.key,
key: item.key, key: item.key,
label: item.name label: item.name
})) || [] })) || []
......
...@@ -247,10 +247,7 @@ const EditModal = ({ onClose, ...props }: RenderInputProps & { onClose: () => vo ...@@ -247,10 +247,7 @@ const EditModal = ({ onClose, ...props }: RenderInputProps & { onClose: () => vo
</Flex> </Flex>
<PromptEditor <PromptEditor
variables={quoteTemplateVariables.map((item) => ({ variables={quoteTemplateVariables}
...item,
id: item.key
}))}
minH={160} minH={160}
title={t('common:core.app.Quote templates')} title={t('common:core.app.Quote templates')}
placeholder={t('workflow:quote_content_placeholder')} placeholder={t('workflow:quote_content_placeholder')}
...@@ -271,10 +268,7 @@ const EditModal = ({ onClose, ...props }: RenderInputProps & { onClose: () => vo ...@@ -271,10 +268,7 @@ const EditModal = ({ onClose, ...props }: RenderInputProps & { onClose: () => vo
/> />
</Flex> </Flex>
<PromptEditor <PromptEditor
variables={quotePromptVariables.map((item) => ({ variables={quotePromptVariables}
...item,
id: item.key
}))}
title={t('common:core.app.Quote prompt')} title={t('common:core.app.Quote prompt')}
minH={300} minH={300}
placeholder={t('workflow:quote_prompt_tip', { placeholder={t('workflow:quote_prompt_tip', {
......
...@@ -107,7 +107,6 @@ export const getEditorVariables = ({ ...@@ -107,7 +107,6 @@ export const getEditorVariables = ({
const nodeVariables = currentNode.inputs const nodeVariables = currentNode.inputs
.filter((input) => input.canEdit) .filter((input) => input.canEdit)
.map((item) => ({ .map((item) => ({
id: item.key,
key: item.key, key: item.key,
label: item.label, label: item.label,
parent: { parent: {
...@@ -138,7 +137,6 @@ export const getEditorVariables = ({ ...@@ -138,7 +137,6 @@ export const getEditorVariables = ({
) )
.map((output) => { .map((output) => {
return { return {
id: output.id,
label: t((output.label as any) || ''), label: t((output.label as any) || ''),
key: output.id, key: output.id,
parent: { parent: {
......
...@@ -582,35 +582,30 @@ export function filterSensitiveFormData(appForm: AppSimpleEditFormType) { ...@@ -582,35 +582,30 @@ export function filterSensitiveFormData(appForm: AppSimpleEditFormType) {
export const workflowSystemVariables: EditorVariablePickerType[] = [ export const workflowSystemVariables: EditorVariablePickerType[] = [
{ {
id: 'userId',
key: 'userId', key: 'userId',
label: i18nT('workflow:use_user_id'), label: i18nT('workflow:use_user_id'),
required: true, required: true,
valueType: WorkflowIOValueTypeEnum.string valueType: WorkflowIOValueTypeEnum.string
}, },
{ {
id: 'appId',
key: 'appId', key: 'appId',
label: i18nT('common:core.module.http.AppId'), label: i18nT('common:core.module.http.AppId'),
required: true, required: true,
valueType: WorkflowIOValueTypeEnum.string valueType: WorkflowIOValueTypeEnum.string
}, },
{ {
id: 'chatId',
key: 'chatId', key: 'chatId',
label: i18nT('common:core.module.http.ChatId'), label: i18nT('common:core.module.http.ChatId'),
valueType: WorkflowIOValueTypeEnum.string, valueType: WorkflowIOValueTypeEnum.string,
required: true required: true
}, },
{ {
id: 'responseChatItemId',
key: 'responseChatItemId', key: 'responseChatItemId',
label: i18nT('common:core.module.http.ResponseChatItemId'), label: i18nT('common:core.module.http.ResponseChatItemId'),
valueType: WorkflowIOValueTypeEnum.string, valueType: WorkflowIOValueTypeEnum.string,
required: true required: true
}, },
{ {
id: 'histories',
key: 'histories', key: 'histories',
label: i18nT('common:core.module.http.Histories'), label: i18nT('common:core.module.http.Histories'),
required: true, required: true,
...@@ -618,7 +613,6 @@ export const workflowSystemVariables: EditorVariablePickerType[] = [ ...@@ -618,7 +613,6 @@ export const workflowSystemVariables: EditorVariablePickerType[] = [
valueDesc: chatHistoryValueDesc valueDesc: chatHistoryValueDesc
}, },
{ {
id: 'cTime',
key: 'cTime', key: 'cTime',
label: i18nT('common:core.module.http.Current time'), label: i18nT('common:core.module.http.Current time'),
required: true, required: true,
......
...@@ -54,7 +54,7 @@ export const getGlobalVariableNode = ({ ...@@ -54,7 +54,7 @@ export const getGlobalVariableNode = ({
nodeId: VARIABLE_NODE_ID, nodeId: VARIABLE_NODE_ID,
...template, ...template,
outputs: globalVariables.map((item) => ({ outputs: globalVariables.map((item) => ({
id: item.id, id: item.key,
type: FlowNodeOutputTypeEnum.static, type: FlowNodeOutputTypeEnum.static,
label: item.label, label: item.label,
key: item.key, key: item.key,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment