mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-25 06:14:06 +00:00
fix: quote settings default value & zindex & i18n (#2931)
This commit is contained in:
@@ -129,7 +129,7 @@ export default function VariableLabelPickerPlugin({
|
|||||||
color={'myGray.600'}
|
color={'myGray.600'}
|
||||||
fontWeight={'semibold'}
|
fontWeight={'semibold'}
|
||||||
>
|
>
|
||||||
{item.label}
|
{t(item.label as any)}
|
||||||
</Box>
|
</Box>
|
||||||
</Flex>
|
</Flex>
|
||||||
{item.children?.map((child) => (
|
{item.children?.map((child) => (
|
||||||
|
@@ -37,7 +37,7 @@ const ButtonEdge = (props: EdgeProps) => {
|
|||||||
}, [nodeList, source, target]);
|
}, [nodeList, source, target]);
|
||||||
|
|
||||||
const defaultZIndex = useMemo(
|
const defaultZIndex = useMemo(
|
||||||
() => (nodeList.find((node) => node.nodeId === source && node.parentNodeId) ? 1001 : 0),
|
() => (nodeList.find((node) => node.nodeId === source && node.parentNodeId) ? 2002 : 0),
|
||||||
[nodeList, source]
|
[nodeList, source]
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -159,7 +159,7 @@ const ButtonEdge = (props: EdgeProps) => {
|
|||||||
bg={'white'}
|
bg={'white'}
|
||||||
borderRadius={'17px'}
|
borderRadius={'17px'}
|
||||||
cursor={'pointer'}
|
cursor={'pointer'}
|
||||||
zIndex={9999}
|
zIndex={defaultZIndex + 1000}
|
||||||
onClick={() => onDelConnect(id)}
|
onClick={() => onDelConnect(id)}
|
||||||
>
|
>
|
||||||
<MyIcon name={'core/workflow/closeEdge'} w={'100%'}></MyIcon>
|
<MyIcon name={'core/workflow/closeEdge'} w={'100%'}></MyIcon>
|
||||||
@@ -173,8 +173,7 @@ const ButtonEdge = (props: EdgeProps) => {
|
|||||||
pointerEvents={'all'}
|
pointerEvents={'all'}
|
||||||
w={highlightEdge ? '14px' : '10px'}
|
w={highlightEdge ? '14px' : '10px'}
|
||||||
h={highlightEdge ? '14px' : '10px'}
|
h={highlightEdge ? '14px' : '10px'}
|
||||||
// bg={'white'}
|
zIndex={highlightEdge ? defaultZIndex + 1000 : defaultZIndex}
|
||||||
zIndex={highlightEdge ? 1000 : defaultZIndex}
|
|
||||||
>
|
>
|
||||||
<MyIcon
|
<MyIcon
|
||||||
name={'core/workflow/edgeArrow'}
|
name={'core/workflow/edgeArrow'}
|
||||||
|
@@ -160,7 +160,6 @@ const Workflow = () => {
|
|||||||
}
|
}
|
||||||
: {})}
|
: {})}
|
||||||
onNodeDragStop={onNodeDragStop}
|
onNodeDragStop={onNodeDragStop}
|
||||||
// deleteKeyCode={[]}
|
|
||||||
>
|
>
|
||||||
<FlowController />
|
<FlowController />
|
||||||
<HelperLines horizontal={helperLineHorizontal} vertical={helperLineVertical} />
|
<HelperLines horizontal={helperLineHorizontal} vertical={helperLineVertical} />
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import React, { useCallback, useMemo, useState } from 'react';
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||||
import type { RenderInputProps } from '../type';
|
import type { RenderInputProps } from '../type';
|
||||||
import { Box, BoxProps, Button, Flex, ModalFooter, useDisclosure } from '@chakra-ui/react';
|
import { Box, BoxProps, Button, Flex, ModalFooter, useDisclosure } from '@chakra-ui/react';
|
||||||
import MyModal from '@fastgpt/web/components/common/MyModal';
|
import MyModal from '@fastgpt/web/components/common/MyModal';
|
||||||
@@ -50,16 +50,23 @@ const SettingQuotePrompt = (props: RenderInputProps) => {
|
|||||||
const onChangeNode = useContextSelector(WorkflowContext, (v) => v.onChangeNode);
|
const onChangeNode = useContextSelector(WorkflowContext, (v) => v.onChangeNode);
|
||||||
const nodeList = useContextSelector(WorkflowContext, (v) => v.nodeList);
|
const nodeList = useContextSelector(WorkflowContext, (v) => v.nodeList);
|
||||||
|
|
||||||
const { watch, setValue, handleSubmit } = useForm({
|
const defaultValues = useMemo(() => {
|
||||||
defaultValues: {
|
return {
|
||||||
quoteTemplate:
|
quoteTemplate:
|
||||||
inputs.find((input) => input.key === NodeInputKeyEnum.aiChatQuoteTemplate)?.value || '',
|
inputs.find((input) => input.key === NodeInputKeyEnum.aiChatQuoteTemplate)?.value || '',
|
||||||
quotePrompt:
|
quotePrompt:
|
||||||
inputs.find((input) => input.key === NodeInputKeyEnum.aiChatQuotePrompt)?.value || '',
|
inputs.find((input) => input.key === NodeInputKeyEnum.aiChatQuotePrompt)?.value || '',
|
||||||
quoteRole: (inputs.find((input) => input.key === NodeInputKeyEnum.aiChatQuoteRole)?.value ||
|
quoteRole: (inputs.find((input) => input.key === NodeInputKeyEnum.aiChatQuoteRole)?.value ||
|
||||||
'system') as AiChatQuoteRoleType
|
'system') as AiChatQuoteRoleType
|
||||||
}
|
};
|
||||||
});
|
}, [inputs]);
|
||||||
|
|
||||||
|
const { watch, setValue, handleSubmit, reset } = useForm({ defaultValues });
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
reset(defaultValues);
|
||||||
|
}, [defaultValues, reset]);
|
||||||
|
|
||||||
const aiChatQuoteTemplate = watch('quoteTemplate');
|
const aiChatQuoteTemplate = watch('quoteTemplate');
|
||||||
const aiChatQuotePrompt = watch('quotePrompt');
|
const aiChatQuotePrompt = watch('quotePrompt');
|
||||||
const aiChatQuoteRole = watch('quoteRole');
|
const aiChatQuoteRole = watch('quoteRole');
|
||||||
|
@@ -123,6 +123,7 @@ export const getEditorVariables = ({
|
|||||||
const sourceNodeVariables = !sourceNodes
|
const sourceNodeVariables = !sourceNodes
|
||||||
? []
|
? []
|
||||||
: sourceNodes
|
: sourceNodes
|
||||||
|
.reverse()
|
||||||
.map((node) => {
|
.map((node) => {
|
||||||
return node.outputs
|
return node.outputs
|
||||||
.filter((output) => !!output.label)
|
.filter((output) => !!output.label)
|
||||||
|
Reference in New Issue
Block a user