mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 21:13:50 +00:00
perf: change value desc position & fix templates (#2413)
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"name": "系统配置",
|
||||
"intro": "可以配置应用的系统参数",
|
||||
"avatar": "core/workflow/template/systemConfig",
|
||||
"flowNodeType": "FlowNodeTypeEnum.systemConfig",
|
||||
"flowNodeType": "userGuide",
|
||||
"position": {
|
||||
"x": 531.2422736065552,
|
||||
"y": -486.7611729549753
|
||||
@@ -75,7 +75,7 @@
|
||||
"name": "流程开始",
|
||||
"intro": "",
|
||||
"avatar": "core/workflow/template/workflowStart",
|
||||
"flowNodeType": "FlowNodeTypeEnum.workflowStart",
|
||||
"flowNodeType": "workflowStart",
|
||||
"position": {
|
||||
"x": 558.4082376415505,
|
||||
"y": 123.72387429194112
|
||||
@@ -106,7 +106,7 @@
|
||||
"name": "AI 对话",
|
||||
"intro": "AI 大模型对话",
|
||||
"avatar": "core/workflow/template/aiChat",
|
||||
"flowNodeType": "FlowNodeTypeEnum.chatNode",
|
||||
"flowNodeType": "chatNode",
|
||||
"showStatus": true,
|
||||
"position": {
|
||||
"x": 2701.1267277679685,
|
||||
@@ -229,7 +229,7 @@
|
||||
"name": "问题分类",
|
||||
"intro": "根据用户的历史记录和当前问题判断该次提问的类型。可以添加多组问题类型,下面是一个模板例子:\n类型1: 打招呼\n类型2: 关于商品\"使用\"问题\n类型3: 关于商品\"购买\"问题\n类型4: 其他问题",
|
||||
"avatar": "core/workflow/template/questionClassify",
|
||||
"flowNodeType": "FlowNodeTypeEnum.classifyQuestion",
|
||||
"flowNodeType": "classifyQuestion",
|
||||
"showStatus": true,
|
||||
"position": {
|
||||
"x": 1020.9667229609946,
|
||||
@@ -316,7 +316,7 @@
|
||||
"name": "指定回复",
|
||||
"intro": "该模块可以直接回复一段指定的内容。常用于引导、提示。非字符串内容传入时,会转成字符串进行输出。",
|
||||
"avatar": "core/workflow/template/reply",
|
||||
"flowNodeType": "FlowNodeTypeEnum.answerNode",
|
||||
"flowNodeType": "answerNode",
|
||||
"position": {
|
||||
"x": 1874.9167551056487,
|
||||
"y": 434.98431875888207
|
||||
@@ -341,7 +341,7 @@
|
||||
"name": "知识库搜索",
|
||||
"intro": "调用\"语义检索\"和\"全文检索\"能力,从\"知识库\"中查找可能与问题相关的参考内容",
|
||||
"avatar": "core/workflow/template/datasetSearch",
|
||||
"flowNodeType": "FlowNodeTypeEnum.datasetSearchNode",
|
||||
"flowNodeType": "datasetSearchNode",
|
||||
"showStatus": true,
|
||||
"position": {
|
||||
"x": 1851.010152279949,
|
||||
|
@@ -12,7 +12,7 @@
|
||||
"name": "系统配置",
|
||||
"intro": "可以配置应用的系统参数",
|
||||
"avatar": "core/workflow/template/systemConfig",
|
||||
"flowNodeType": "FlowNodeTypeEnum.systemConfig",
|
||||
"flowNodeType": "userGuide",
|
||||
"position": {
|
||||
"x": 531.2422736065552,
|
||||
"y": -486.7611729549753
|
||||
@@ -75,7 +75,7 @@
|
||||
"name": "流程开始",
|
||||
"intro": "",
|
||||
"avatar": "core/workflow/template/workflowStart",
|
||||
"flowNodeType": "FlowNodeTypeEnum.workflowStart",
|
||||
"flowNodeType": "workflowStart",
|
||||
"position": {
|
||||
"x": 558.4082376415505,
|
||||
"y": 123.72387429194112
|
||||
@@ -106,7 +106,7 @@
|
||||
"name": "AI 对话",
|
||||
"intro": "AI 大模型对话",
|
||||
"avatar": "core/workflow/template/aiChat",
|
||||
"flowNodeType": "FlowNodeTypeEnum.chatNode",
|
||||
"flowNodeType": "chatNode",
|
||||
"showStatus": true,
|
||||
"position": {
|
||||
"x": 1638.509551404687,
|
||||
@@ -229,7 +229,7 @@
|
||||
"name": "知识库搜索",
|
||||
"intro": "调用\"语义检索\"和\"全文检索\"能力,从\"知识库\"中查找可能与问题相关的参考内容",
|
||||
"avatar": "core/workflow/template/datasetSearch",
|
||||
"flowNodeType": "FlowNodeTypeEnum.datasetSearchNode",
|
||||
"flowNodeType": "datasetSearchNode",
|
||||
"showStatus": true,
|
||||
"position": {
|
||||
"x": 918.5901682164496,
|
||||
|
@@ -7,11 +7,7 @@ import RenderInput from './render/RenderInput';
|
||||
import { Box, Button, Flex, HStack } from '@chakra-ui/react';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { SmallAddIcon } from '@chakra-ui/icons';
|
||||
import {
|
||||
WorkflowIOValueTypeEnum,
|
||||
NodeInputKeyEnum,
|
||||
VARIABLE_NODE_ID
|
||||
} from '@fastgpt/global/core/workflow/constants';
|
||||
import { NodeInputKeyEnum, VARIABLE_NODE_ID } from '@fastgpt/global/core/workflow/constants';
|
||||
import { getOneQuoteInputTemplate } from '@fastgpt/global/core/workflow/template/system/datasetConcat';
|
||||
import { FlowNodeTypeEnum } from '@fastgpt/global/core/workflow/node/constant';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
@@ -189,7 +185,7 @@ function Reference({
|
||||
<Flex alignItems={'center'} mb={1}>
|
||||
<FormLabel required={inputChildren.required}>{inputChildren.label}</FormLabel>
|
||||
{/* value */}
|
||||
<ValueTypeLabel valueType={inputChildren.valueType} />
|
||||
<ValueTypeLabel valueType={inputChildren.valueType} valueDesc={inputChildren.valueDesc} />
|
||||
|
||||
<MyIcon
|
||||
className="delete"
|
||||
|
@@ -176,7 +176,7 @@ function Reference({
|
||||
<FormLabel required={input.required}>{input.label}</FormLabel>
|
||||
{input.description && <QuestionTip ml={0.5} label={input.description}></QuestionTip>}
|
||||
{/* value */}
|
||||
<ValueTypeLabel valueType={input.valueType} />
|
||||
<ValueTypeLabel valueType={input.valueType} valueDesc={input.valueDesc} />
|
||||
|
||||
<MyIcon
|
||||
name={'common/settingLight'}
|
||||
|
@@ -11,7 +11,10 @@ import { WorkflowContext } from '../../context';
|
||||
import { useCreation } from 'ahooks';
|
||||
import { getWorkflowGlobalVariables } from '@/web/core/workflow/utils';
|
||||
import { FlowNodeOutputItemType } from '@fastgpt/global/core/workflow/type/io';
|
||||
import { FlowNodeOutputTypeEnum } from '@fastgpt/global/core/workflow/node/constant';
|
||||
import {
|
||||
chatHistoryValueDesc,
|
||||
FlowNodeOutputTypeEnum
|
||||
} from '@fastgpt/global/core/workflow/node/constant';
|
||||
import { WorkflowIOValueTypeEnum } from '@fastgpt/global/core/workflow/constants';
|
||||
import { AppContext } from '@/pages/app/detail/components/context';
|
||||
import { userFilesInput } from '@fastgpt/global/core/workflow/template/system/workflowStart';
|
||||
@@ -30,14 +33,27 @@ const NodeStart = ({ data, selected }: NodeProps<FlowNodeItemType>) => {
|
||||
t
|
||||
});
|
||||
|
||||
return variables.map<FlowNodeOutputItemType>((item) => ({
|
||||
id: item.key,
|
||||
type: FlowNodeOutputTypeEnum.static,
|
||||
key: item.key,
|
||||
required: item.required,
|
||||
valueType: item.valueType || WorkflowIOValueTypeEnum.any,
|
||||
label: item.label
|
||||
}));
|
||||
return variables.map<FlowNodeOutputItemType>((item) => {
|
||||
if (item.valueType === WorkflowIOValueTypeEnum.chatHistory) {
|
||||
return {
|
||||
id: item.key,
|
||||
type: FlowNodeOutputTypeEnum.static,
|
||||
key: item.key,
|
||||
required: item.required,
|
||||
valueType: item.valueType,
|
||||
valueDesc: chatHistoryValueDesc,
|
||||
label: item.label
|
||||
};
|
||||
}
|
||||
return {
|
||||
id: item.key,
|
||||
type: FlowNodeOutputTypeEnum.static,
|
||||
key: item.key,
|
||||
required: item.required,
|
||||
valueType: item.valueType || WorkflowIOValueTypeEnum.any,
|
||||
label: item.label
|
||||
};
|
||||
});
|
||||
}, [nodeList, t]);
|
||||
|
||||
// Dynamic add or delete userFilesInput
|
||||
|
@@ -24,8 +24,6 @@ import { useForm } from 'react-hook-form';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { useMount } from 'ahooks';
|
||||
import FormLabel from '@fastgpt/web/components/common/MyBox/FormLabel';
|
||||
import { useContextSelector } from 'use-context-selector';
|
||||
import { WorkflowContext } from '../../../../context';
|
||||
|
||||
const FieldModal = ({
|
||||
customInputConfig,
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import { FlowNodeInputItemType } from '@fastgpt/global/core/workflow/type/io.d';
|
||||
import React, { useCallback, useMemo } from 'react';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { Box, Flex, HStack } from '@chakra-ui/react';
|
||||
import { Box, Flex } from '@chakra-ui/react';
|
||||
|
||||
import NodeInputSelect from '@fastgpt/web/components/core/workflow/NodeInputSelect';
|
||||
import { FlowNodeInputTypeEnum } from '@fastgpt/global/core/workflow/node/constant';
|
||||
@@ -10,9 +10,6 @@ import { useContextSelector } from 'use-context-selector';
|
||||
import { WorkflowContext } from '@/pages/app/detail/components/WorkflowComponents/context';
|
||||
import QuestionTip from '@fastgpt/web/components/common/MyTooltip/QuestionTip';
|
||||
import FormLabel from '@fastgpt/web/components/common/MyBox/FormLabel';
|
||||
import MyTooltip from '@fastgpt/web/components/common/MyTooltip';
|
||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
import MyTag from '@fastgpt/web/components/common/Tag/index';
|
||||
import VariableTip from '@/components/common/Textarea/MyTextarea/VariableTip';
|
||||
|
||||
type Props = {
|
||||
@@ -25,7 +22,8 @@ const InputLabel = ({ nodeId, input }: Props) => {
|
||||
|
||||
const onChangeNode = useContextSelector(WorkflowContext, (v) => v.onChangeNode);
|
||||
|
||||
const { description, required, label, selectedTypeIndex, renderTypeList, valueType } = input;
|
||||
const { description, required, label, selectedTypeIndex, renderTypeList, valueType, valueDesc } =
|
||||
input;
|
||||
|
||||
const onChangeRenderType = useCallback(
|
||||
(e: string) => {
|
||||
@@ -60,7 +58,9 @@ const InputLabel = ({ nodeId, input }: Props) => {
|
||||
{description && <QuestionTip ml={1} label={t(description as any)}></QuestionTip>}
|
||||
</Flex>
|
||||
{/* value type */}
|
||||
{renderType === FlowNodeInputTypeEnum.reference && <ValueTypeLabel valueType={valueType} />}
|
||||
{renderType === FlowNodeInputTypeEnum.reference && (
|
||||
<ValueTypeLabel valueType={valueType} valueDesc={valueDesc} />
|
||||
)}
|
||||
|
||||
{/* input type select */}
|
||||
{renderTypeList && renderTypeList.length > 1 && (
|
||||
|
@@ -184,7 +184,7 @@ function Reference({
|
||||
<QuestionTip ml={1} label={inputChildren.description}></QuestionTip>
|
||||
)}
|
||||
{/* value */}
|
||||
<ValueTypeLabel valueType={inputChildren.valueType} />
|
||||
<ValueTypeLabel valueType={inputChildren.valueType} valueDesc={inputChildren.valueDesc} />
|
||||
|
||||
<MyIcon
|
||||
name={'common/settingLight'}
|
||||
|
@@ -24,6 +24,7 @@ import { useCreation } from 'ahooks';
|
||||
import { AppContext } from '@/pages/app/detail/components/context';
|
||||
import QuestionTip from '@fastgpt/web/components/common/MyTooltip/QuestionTip';
|
||||
import FormLabel from '@fastgpt/web/components/common/MyBox/FormLabel';
|
||||
import { datasetQuoteValueDesc } from '@fastgpt/global/core/workflow/node/constant';
|
||||
|
||||
const LabelStyles: BoxProps = {
|
||||
fontSize: ['sm', 'md']
|
||||
@@ -154,7 +155,10 @@ const SettingQuotePrompt = (props: RenderInputProps) => {
|
||||
<Box position={'relative'} color={'myGray.600'} fontWeight={'medium'}>
|
||||
{t('common:core.module.Dataset quote.label')}
|
||||
</Box>
|
||||
<ValueTypeLabel valueType={WorkflowIOValueTypeEnum.datasetQuote} />
|
||||
<ValueTypeLabel
|
||||
valueType={WorkflowIOValueTypeEnum.datasetQuote}
|
||||
valueDesc={datasetQuoteValueDesc}
|
||||
/>
|
||||
|
||||
<MyTooltip label={t('common:core.module.Setting quote prompt')}>
|
||||
<MyIcon
|
||||
|
@@ -14,7 +14,6 @@ import {
|
||||
Textarea
|
||||
} from '@chakra-ui/react';
|
||||
import { WorkflowIOValueTypeEnum } from '@fastgpt/global/core/workflow/constants';
|
||||
import { FlowNodeInputTypeEnum } from '@fastgpt/global/core/workflow/node/constant';
|
||||
import {
|
||||
CustomFieldConfigType,
|
||||
FlowNodeOutputItemType
|
||||
@@ -25,7 +24,6 @@ import { useToast } from '@fastgpt/web/hooks/useToast';
|
||||
import React, { useCallback, useMemo } from 'react';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { useMount } from 'ahooks';
|
||||
import FormLabel from '@fastgpt/web/components/common/MyBox/FormLabel';
|
||||
import { getNanoid } from '@fastgpt/global/common/string/tools';
|
||||
|
||||
|
@@ -11,7 +11,7 @@ import ValueTypeLabel from '../ValueTypeLabel';
|
||||
|
||||
const OutputLabel = ({ nodeId, output }: { nodeId: string; output: FlowNodeOutputItemType }) => {
|
||||
const { t } = useTranslation();
|
||||
const { label = '', description, valueType } = output;
|
||||
const { label = '', description, valueType, valueDesc } = output;
|
||||
|
||||
const Render = useMemo(() => {
|
||||
return (
|
||||
@@ -36,7 +36,7 @@ const OutputLabel = ({ nodeId, output }: { nodeId: string; output: FlowNodeOutpu
|
||||
{t(label as any)}
|
||||
</Box>
|
||||
{description && <QuestionTip ml={1} label={t(description as any)} />}
|
||||
<ValueTypeLabel valueType={valueType} />
|
||||
<ValueTypeLabel valueType={valueType} valueDesc={valueDesc} />
|
||||
</Flex>
|
||||
{output.type === FlowNodeOutputTypeEnum.source && (
|
||||
<SourceHandle
|
||||
|
@@ -4,14 +4,19 @@ import { WorkflowIOValueTypeEnum } from '@fastgpt/global/core/workflow/constants
|
||||
import MyTooltip from '@fastgpt/web/components/common/MyTooltip';
|
||||
import React from 'react';
|
||||
|
||||
const ValueTypeLabel = ({ valueType }: { valueType?: WorkflowIOValueTypeEnum }) => {
|
||||
const ValueTypeLabel = ({
|
||||
valueType,
|
||||
valueDesc
|
||||
}: {
|
||||
valueType?: WorkflowIOValueTypeEnum;
|
||||
valueDesc?: string;
|
||||
}) => {
|
||||
const valueTypeData = valueType ? FlowValueTypeMap[valueType] : undefined;
|
||||
|
||||
const label = valueTypeData?.label || '';
|
||||
const description = valueTypeData?.description || '';
|
||||
|
||||
return !!label ? (
|
||||
<MyTooltip label={description}>
|
||||
<MyTooltip label={valueDesc}>
|
||||
<Box
|
||||
bg={'myGray.100'}
|
||||
color={'myGray.500'}
|
||||
|
Reference in New Issue
Block a user