fix node variable update render (#5251)

* fix node variable update render

* editor value formatted

* fix
This commit is contained in:
heheer
2025-07-18 15:48:26 +08:00
committed by GitHub
parent 530f30e3e8
commit 6f75c1b80e
12 changed files with 59 additions and 33 deletions
@@ -20,6 +20,7 @@ import ChatRecordContextProvider, {
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
import { useContextSelector } from 'use-context-selector';
import ChatQuoteList from '@/pageComponents/chat/ChatQuoteList';
import { ChatTypeEnum } from '@/components/core/chat/ChatContainer/ChatBox/constants';
const PluginRunBox = dynamic(() => import('@/components/core/chat/ChatContainer/PluginRunBox'));
const ChatBox = dynamic(() => import('@/components/core/chat/ChatContainer/ChatBox'));
@@ -164,7 +165,7 @@ const DetailLogsModal = ({ appId, chatId, onClose }: Props) => {
feedbackType={'admin'}
showMarkIcon
showVoiceIcon={false}
chatType="log"
chatType={ChatTypeEnum.log}
/>
)}
</Box>
@@ -31,6 +31,7 @@ import { WorkflowNodeEdgeContext } from '../../context/workflowInitContext';
import { useSystemStore } from '@/web/common/system/useSystemStore';
import InputRender from '@/components/core/app/formRender';
import { valueTypeToInputType } from '@/components/core/app/formRender/utils';
import { isValidReferenceValueFormat } from '@fastgpt/global/core/workflow/utils';
const NodeVariableUpdate = ({ data, selected }: NodeProps<FlowNodeItemType>) => {
const { inputs = [], nodeId } = data;
@@ -110,19 +111,19 @@ const NodeVariableUpdate = ({ data, selected }: NodeProps<FlowNodeItemType>) =>
(item) => item.renderType === updateItem.renderType
);
const onUpdateNewValue = (newValue?: ReferenceValueType | string) => {
if (typeof newValue === 'string') {
onUpdateList(
updateList.map((update, i) =>
i === index ? { ...update, value: ['', newValue] } : update
)
);
} else if (newValue) {
const onUpdateNewValue = (newValue: any) => {
if (isValidReferenceValueFormat(newValue)) {
onUpdateList(
updateList.map((update, i) =>
i === index ? { ...update, value: newValue as ReferenceItemValueType } : update
)
);
} else {
onUpdateList(
updateList.map((update, i) =>
i === index ? { ...update, value: ['', newValue] } : update
)
);
}
};
@@ -224,7 +225,7 @@ const NodeVariableUpdate = ({ data, selected }: NodeProps<FlowNodeItemType>) =>
const inputValue = isArray(updateItem.value?.[1]) ? '' : updateItem.value?.[1];
return (
<Box w={'300px'} bg={'white'} borderRadius={'sm'}>
<Box w={'300px'} borderRadius={'sm'}>
<InputRender
inputType={valueTypeToInputType(valueType)}
value={inputValue || ''}
@@ -18,6 +18,7 @@ import { ChatItemContext } from '@/web/core/chat/context/chatItemContext';
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
import { getInitChatInfo } from '@/web/core/chat/api';
import { useTranslation } from 'next-i18next';
import { ChatTypeEnum } from '@/components/core/chat/ChatContainer/ChatBox/constants';
const PluginRunBox = dynamic(() => import('@/components/core/chat/ChatContainer/PluginRunBox'));
@@ -140,7 +141,7 @@ export const useChatTest = ({
appId={appId}
chatId={chatId}
showMarkIcon
chatType={'chat'}
chatType={ChatTypeEnum.chat}
onStartChat={startChat}
/>
)