mirror of
https://github.com/labring/FastGPT.git
synced 2026-05-07 01:02:55 +08:00
perf: workflow runtime (#6562)
* perf: workflow runtime * perf: lable input and dispatch workflow * fix: workflow dispatch * fix: workflow dispatch * fix: workflow dispatch * fix: workflow dispatch * perf: workflow runtime * perf: workflow runtime
This commit is contained in:
@@ -32,6 +32,7 @@ const getFlattenedErrorKeys = (errors: any, prefix = ''): string[] => {
|
||||
const LabelAndFormRender = ({
|
||||
label,
|
||||
required,
|
||||
description,
|
||||
placeholder,
|
||||
inputType,
|
||||
showValueType,
|
||||
@@ -40,6 +41,7 @@ const LabelAndFormRender = ({
|
||||
}: {
|
||||
label: string | React.ReactNode;
|
||||
required?: boolean;
|
||||
description?: string;
|
||||
placeholder?: string;
|
||||
showValueType?: boolean;
|
||||
form: UseFormReturn<any>;
|
||||
@@ -57,7 +59,7 @@ const LabelAndFormRender = ({
|
||||
<Box _notLast={{ mb: 4 }}>
|
||||
<Flex alignItems={'center'} mb={1}>
|
||||
{typeof label === 'string' ? <FormLabel required={required}>{t(label)}</FormLabel> : label}
|
||||
{placeholder && <QuestionTip ml={1} label={placeholder} />}
|
||||
{description && <QuestionTip ml={1} label={description} />}
|
||||
</Flex>
|
||||
|
||||
<Controller
|
||||
|
||||
+3
-3
@@ -107,7 +107,7 @@ const VariableInputForm = ({
|
||||
{...item}
|
||||
isUnChange={isUnChange}
|
||||
key={item.key}
|
||||
placeholder={item.description}
|
||||
description={item.description}
|
||||
inputType={variableInputTypeToInputType(item.type, item.valueType)}
|
||||
form={variablesForm}
|
||||
fieldName={`variables.${item.key}`}
|
||||
@@ -150,7 +150,7 @@ const VariableInputForm = ({
|
||||
{...item}
|
||||
isUnChange={isUnChange}
|
||||
key={item.key}
|
||||
placeholder={item.description}
|
||||
description={item.description}
|
||||
inputType={variableInputTypeToInputType(item.type, item.valueType)}
|
||||
form={variablesForm}
|
||||
fieldName={`variables.${item.key}`}
|
||||
@@ -192,7 +192,7 @@ const VariableInputForm = ({
|
||||
{...item}
|
||||
isUnChange={isUnChange}
|
||||
key={item.key}
|
||||
placeholder={item.description}
|
||||
description={item.description}
|
||||
inputType={variableInputTypeToInputType(item.type)}
|
||||
bg={'myGray.50'}
|
||||
form={variablesForm}
|
||||
|
||||
+2
-2
@@ -47,7 +47,7 @@ const ChatHomeVariablesForm = ({ chatForm }: Props) => {
|
||||
{...item}
|
||||
key={item.key}
|
||||
fieldName={`variables.${item.key}`}
|
||||
placeholder={item.description}
|
||||
description={item.description}
|
||||
inputType={variableInputTypeToInputType(item.type, item.valueType)}
|
||||
form={variablesForm}
|
||||
bg={'myGray.50'}
|
||||
@@ -63,7 +63,7 @@ const ChatHomeVariablesForm = ({ chatForm }: Props) => {
|
||||
{...item}
|
||||
key={item.key}
|
||||
fieldName={`variables.${item.key}`}
|
||||
placeholder={item.description}
|
||||
description={item.description}
|
||||
inputType={variableInputTypeToInputType(item.type)}
|
||||
form={variablesForm}
|
||||
bg={'myGray.50'}
|
||||
|
||||
@@ -104,7 +104,7 @@ const VariablePopover = ({ chatType }: { chatType: ChatTypeEnum }) => {
|
||||
<LabelAndFormRender
|
||||
{...item}
|
||||
key={item.key}
|
||||
placeholder={item.description}
|
||||
description={item.description}
|
||||
inputType={variableInputTypeToInputType(item.type)}
|
||||
form={variablesForm}
|
||||
fieldName={`variables.${item.key}`}
|
||||
@@ -137,7 +137,7 @@ const VariablePopover = ({ chatType }: { chatType: ChatTypeEnum }) => {
|
||||
<LabelAndFormRender
|
||||
{...item}
|
||||
key={item.key}
|
||||
placeholder={item.description}
|
||||
description={item.description}
|
||||
inputType={variableInputTypeToInputType(item.type)}
|
||||
form={variablesForm}
|
||||
fieldName={`variables.${item.key}`}
|
||||
@@ -156,7 +156,7 @@ const VariablePopover = ({ chatType }: { chatType: ChatTypeEnum }) => {
|
||||
<LabelAndFormRender
|
||||
{...item}
|
||||
key={item.key}
|
||||
placeholder={item.description}
|
||||
description={item.description}
|
||||
inputType={variableInputTypeToInputType(item.type)}
|
||||
form={variablesForm}
|
||||
fieldName={`variables.${item.key}`}
|
||||
|
||||
@@ -147,7 +147,7 @@ const ChatTest = ({
|
||||
inputType={inputType}
|
||||
fieldName={paramName}
|
||||
form={form}
|
||||
placeholder={paramName}
|
||||
description={paramName}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -130,7 +130,8 @@ const ChatTest = ({
|
||||
inputType={inputType}
|
||||
form={form}
|
||||
fieldName={paramName}
|
||||
placeholder={paramInfo.description}
|
||||
bg={'myGray.50'}
|
||||
description={paramInfo.description}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import type { GetMcpToolsBodyType } from '@fastgpt/global/openapi/core/app/mcpTo
|
||||
import { getMCPTools } from '@/web/core/app/api/tool';
|
||||
import HeaderAuthConfig from '@/components/common/secret/HeaderAuthConfig';
|
||||
import { type StoreSecretValueType } from '@fastgpt/global/common/secret/type';
|
||||
import type { JsonSchemaPropertiesItemType } from '@fastgpt/global/core/app/jsonschema';
|
||||
|
||||
const EditForm = ({
|
||||
url,
|
||||
@@ -208,25 +209,30 @@ const ToolDetailModal = ({ tool, onClose }: { tool: McpToolConfigType; onClose:
|
||||
w={'530px'}
|
||||
>
|
||||
<ModalBody>
|
||||
<Flex pb={6} borderBottom={'1px solid'} borderColor={'myGray.200'}>
|
||||
<Flex
|
||||
pb={6}
|
||||
borderBottom={'1px solid'}
|
||||
borderColor={'myGray.200'}
|
||||
alignItems={'flex-start'}
|
||||
>
|
||||
<Avatar src={appDetail.avatar} borderRadius={'md'} w={'40px'} />
|
||||
<Box ml={'14px'}>
|
||||
<Box fontSize={'16px'} color={'myGray.900'}>
|
||||
{tool.name}
|
||||
</Box>
|
||||
<Box fontSize={'12px'} color={'myGray.500'}>
|
||||
<Box fontSize={'12px'} color={'myGray.500'} maxH={'100px'} overflow={'auto'}>
|
||||
{tool.description}
|
||||
</Box>
|
||||
</Box>
|
||||
</Flex>
|
||||
|
||||
<Box mt={6} color={'myGray.900'} fontWeight={'medium'}>
|
||||
{t('common:Params')}
|
||||
{t('app:raw_params')}
|
||||
</Box>
|
||||
|
||||
<Box mt={3}>
|
||||
{Object.entries(tool.inputSchema.properties || {}).map(
|
||||
([paramName, paramInfo]: [string, any]) => (
|
||||
([paramName, paramInfo]: [string, JsonSchemaPropertiesItemType]) => (
|
||||
<Box key={paramName} py={2} borderBottom={'1px solid'} borderColor={'myGray.150'}>
|
||||
<Flex alignItems="center">
|
||||
{tool.inputSchema.required?.includes(paramName) && (
|
||||
@@ -248,7 +254,11 @@ const ToolDetailModal = ({ tool, onClose }: { tool: McpToolConfigType; onClose:
|
||||
border={'1px solid'}
|
||||
borderColor={'myGray.200'}
|
||||
>
|
||||
{paramInfo.type}
|
||||
{paramInfo.type ||
|
||||
paramInfo.anyOf?.map((item) => item.type).join(',') ||
|
||||
paramInfo.oneOf?.map((item) => item.type).join(',') ||
|
||||
paramInfo.allOf?.map((item) => item.type).join(',') ||
|
||||
'any'}
|
||||
</Box>
|
||||
</Flex>
|
||||
|
||||
|
||||
+4
-4
@@ -269,7 +269,7 @@ export const useDebug = () => {
|
||||
key={item.key}
|
||||
label={item.label}
|
||||
required={item.required}
|
||||
placeholder={t(item.placeholder || item.description)}
|
||||
description={t(item.placeholder || item.description)}
|
||||
inputType={nodeInputTypeToInputType(item.renderTypeList)}
|
||||
form={variablesForm}
|
||||
fieldName={`nodeVariables.${item.key}`}
|
||||
@@ -284,7 +284,7 @@ export const useDebug = () => {
|
||||
key={item.key}
|
||||
label={item.label}
|
||||
required={item.required}
|
||||
placeholder={t(item.description)}
|
||||
description={t(item.description)}
|
||||
inputType={variableInputTypeToInputType(item.type)}
|
||||
form={variablesForm}
|
||||
fieldName={`variables.${item.key}`}
|
||||
@@ -297,7 +297,7 @@ export const useDebug = () => {
|
||||
key={item.key}
|
||||
label={item.label}
|
||||
required={item.required}
|
||||
placeholder={t(item.description)}
|
||||
description={t(item.description)}
|
||||
inputType={variableInputTypeToInputType(item.type)}
|
||||
form={variablesForm}
|
||||
fieldName={`variables.${item.key}`}
|
||||
@@ -310,7 +310,7 @@ export const useDebug = () => {
|
||||
key={item.key}
|
||||
label={item.label}
|
||||
required={item.required}
|
||||
placeholder={item.description}
|
||||
description={item.description}
|
||||
inputType={variableInputTypeToInputType(item.type)}
|
||||
form={variablesForm}
|
||||
fieldName={`variables.${item.key}`}
|
||||
|
||||
Reference in New Issue
Block a user