fix: quote settings default value & zindex & i18n (#2931)

This commit is contained in:
heheer
2024-10-16 13:26:51 +08:00
committed by GitHub
parent e56965a8ed
commit 8bdb35ff51
5 changed files with 17 additions and 11 deletions

View File

@@ -129,7 +129,7 @@ export default function VariableLabelPickerPlugin({
color={'myGray.600'}
fontWeight={'semibold'}
>
{item.label}
{t(item.label as any)}
</Box>
</Flex>
{item.children?.map((child) => (

View File

@@ -37,7 +37,7 @@ const ButtonEdge = (props: EdgeProps) => {
}, [nodeList, source, target]);
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]
);
@@ -159,7 +159,7 @@ const ButtonEdge = (props: EdgeProps) => {
bg={'white'}
borderRadius={'17px'}
cursor={'pointer'}
zIndex={9999}
zIndex={defaultZIndex + 1000}
onClick={() => onDelConnect(id)}
>
<MyIcon name={'core/workflow/closeEdge'} w={'100%'}></MyIcon>
@@ -173,8 +173,7 @@ const ButtonEdge = (props: EdgeProps) => {
pointerEvents={'all'}
w={highlightEdge ? '14px' : '10px'}
h={highlightEdge ? '14px' : '10px'}
// bg={'white'}
zIndex={highlightEdge ? 1000 : defaultZIndex}
zIndex={highlightEdge ? defaultZIndex + 1000 : defaultZIndex}
>
<MyIcon
name={'core/workflow/edgeArrow'}

View File

@@ -160,7 +160,6 @@ const Workflow = () => {
}
: {})}
onNodeDragStop={onNodeDragStop}
// deleteKeyCode={[]}
>
<FlowController />
<HelperLines horizontal={helperLineHorizontal} vertical={helperLineVertical} />

View File

@@ -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 { Box, BoxProps, Button, Flex, ModalFooter, useDisclosure } from '@chakra-ui/react';
import MyModal from '@fastgpt/web/components/common/MyModal';
@@ -50,16 +50,23 @@ const SettingQuotePrompt = (props: RenderInputProps) => {
const onChangeNode = useContextSelector(WorkflowContext, (v) => v.onChangeNode);
const nodeList = useContextSelector(WorkflowContext, (v) => v.nodeList);
const { watch, setValue, handleSubmit } = useForm({
defaultValues: {
const defaultValues = useMemo(() => {
return {
quoteTemplate:
inputs.find((input) => input.key === NodeInputKeyEnum.aiChatQuoteTemplate)?.value || '',
quotePrompt:
inputs.find((input) => input.key === NodeInputKeyEnum.aiChatQuotePrompt)?.value || '',
quoteRole: (inputs.find((input) => input.key === NodeInputKeyEnum.aiChatQuoteRole)?.value ||
'system') as AiChatQuoteRoleType
}
});
};
}, [inputs]);
const { watch, setValue, handleSubmit, reset } = useForm({ defaultValues });
useEffect(() => {
reset(defaultValues);
}, [defaultValues, reset]);
const aiChatQuoteTemplate = watch('quoteTemplate');
const aiChatQuotePrompt = watch('quotePrompt');
const aiChatQuoteRole = watch('quoteRole');

View File

@@ -123,6 +123,7 @@ export const getEditorVariables = ({
const sourceNodeVariables = !sourceNodes
? []
: sourceNodes
.reverse()
.map((node) => {
return node.outputs
.filter((output) => !!output.label)