mirror of
https://github.com/labring/FastGPT.git
synced 2025-12-25 20:02:47 +00:00
fix: loop import
This commit is contained in:
parent
74ff38059d
commit
1dab68b5ca
|
|
@ -1,10 +1,10 @@
|
|||
import {
|
||||
type AppTTSConfigType,
|
||||
type AppFileSelectConfigType,
|
||||
type AppWhisperConfigType,
|
||||
type AppAutoExecuteConfigType,
|
||||
type AppQGConfigType
|
||||
} from './type';
|
||||
import type { AppFileSelectConfigType } from './type/config';
|
||||
|
||||
export enum AppTypeEnum {
|
||||
folder = 'folder',
|
||||
|
|
|
|||
|
|
@ -1,10 +1,6 @@
|
|||
import { SelectedDatasetSchema } from '../../workflow/type/io';
|
||||
import { z } from 'zod';
|
||||
import {
|
||||
AppChatConfigTypeSchema,
|
||||
AppDatasetSearchParamsTypeSchema,
|
||||
AppFileSelectConfigTypeSchema
|
||||
} from '../type';
|
||||
import { AppChatConfigTypeSchema, AppDatasetSearchParamsTypeSchema } from '../type';
|
||||
import { FlowNodeTemplateTypeSchema } from '../../workflow/type/node';
|
||||
import { NodeInputKeyEnum } from '../../workflow/constants';
|
||||
|
||||
|
|
|
|||
|
|
@ -11,20 +11,7 @@ import type { WorkflowTemplateBasicType } from '../workflow/type';
|
|||
import type { SourceMemberType } from '../../support/user/type';
|
||||
import z from 'zod';
|
||||
import { ObjectIdSchema } from '../../common/type/mongo';
|
||||
|
||||
/* app chat config type */
|
||||
// File
|
||||
export const AppFileSelectConfigTypeSchema = z.object({
|
||||
maxFiles: z.number().optional(),
|
||||
canSelectFile: z.boolean().optional(),
|
||||
customPdfParse: z.boolean().optional(),
|
||||
canSelectImg: z.boolean().optional(),
|
||||
canSelectVideo: z.boolean().optional(),
|
||||
canSelectAudio: z.boolean().optional(),
|
||||
canSelectCustomFileExtension: z.boolean().optional(),
|
||||
customFileExtensionList: z.array(z.string()).optional()
|
||||
});
|
||||
export type AppFileSelectConfigType = z.infer<typeof AppFileSelectConfigTypeSchema>;
|
||||
import { AppFileSelectConfigTypeSchema } from './type/config';
|
||||
|
||||
// variable
|
||||
export const VariableItemTypeSchema = AppFileSelectConfigTypeSchema.and(
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
import z from 'zod';
|
||||
|
||||
/* app chat file select config type */
|
||||
export const AppFileSelectConfigTypeSchema = z.object({
|
||||
maxFiles: z.number().optional(),
|
||||
canSelectFile: z.boolean().optional(),
|
||||
customPdfParse: z.boolean().optional(),
|
||||
canSelectImg: z.boolean().optional(),
|
||||
canSelectVideo: z.boolean().optional(),
|
||||
canSelectAudio: z.boolean().optional(),
|
||||
canSelectCustomFileExtension: z.boolean().optional(),
|
||||
customFileExtensionList: z.array(z.string()).optional()
|
||||
});
|
||||
export type AppFileSelectConfigType = z.infer<typeof AppFileSelectConfigTypeSchema>;
|
||||
|
|
@ -2,7 +2,7 @@ import { NodeOutputItemSchema } from '../../../../chat/type';
|
|||
import { FlowNodeInputTypeEnum } from '../../../../../core/workflow/node/constant';
|
||||
import { WorkflowIOValueTypeEnum } from '../../../../../core/workflow/constants';
|
||||
import type { ChatCompletionMessageParam } from '../../../../ai/type';
|
||||
import { AppFileSelectConfigTypeSchema } from '../../../../app/type';
|
||||
import { AppFileSelectConfigTypeSchema } from '../../../../app/type/config';
|
||||
import { RuntimeEdgeItemTypeSchema } from '../../../type/edge';
|
||||
import z from 'zod';
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import {
|
|||
} from '@chakra-ui/react';
|
||||
import React, { useState } from 'react';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import type { AppFileSelectConfigType } from '@fastgpt/global/core/app/type';
|
||||
import type { AppFileSelectConfigType } from '@fastgpt/global/core/app/type/config';
|
||||
import MyModal from '@fastgpt/web/components/common/MyModal';
|
||||
import ChatFunctionTip from './Tip';
|
||||
import FormLabel from '@fastgpt/web/components/common/MyBox/FormLabel';
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import MyBox from '@fastgpt/web/components/common/MyBox';
|
|||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
import { ChatFileTypeEnum } from '@fastgpt/global/core/chat/constants';
|
||||
import { getFileIcon } from '@fastgpt/global/common/file/icon';
|
||||
import type { AppFileSelectConfigType } from '@fastgpt/global/core/app/type';
|
||||
import type { AppFileSelectConfigType } from '@fastgpt/global/core/app/type/config';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
import { getUploadFileType } from '@fastgpt/global/core/app/constants';
|
||||
import { useToast } from '@fastgpt/web/hooks/useToast';
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import type { VariableInputEnum } from '@fastgpt/global/core/workflow/constants'
|
|||
import type { UseFormReturn } from 'react-hook-form';
|
||||
import type { BoxProps } from '@chakra-ui/react';
|
||||
import type { EditorProps } from '@fastgpt/web/components/common/Textarea/PromptEditor/Editor';
|
||||
import type { AppFileSelectConfigType } from '@fastgpt/global/core/app/type';
|
||||
import type { SelectedDatasetType } from '@fastgpt/global/core/workflow/type/io';
|
||||
|
||||
type CommonRenderProps = {
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@ import React, { useState, useMemo, useCallback } from 'react';
|
|||
import { useAudioPlay } from '@/web/common/utils/voice';
|
||||
import { type OutLinkChatAuthProps } from '@fastgpt/global/support/permission/chat';
|
||||
import {
|
||||
type AppFileSelectConfigType,
|
||||
type AppQGConfigType,
|
||||
type AppTTSConfigType,
|
||||
type AppWhisperConfigType,
|
||||
type ChatInputGuideConfigType,
|
||||
type VariableItemType
|
||||
} from '@fastgpt/global/core/app/type';
|
||||
import { type AppFileSelectConfigType } from '@fastgpt/global/core/app/type/config';
|
||||
import { type ChatHistoryItemResType } from '@fastgpt/global/core/chat/type';
|
||||
import {
|
||||
defaultAppSelectFileConfig,
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import { clone } from 'lodash';
|
|||
import { getErrText } from '@fastgpt/global/common/error/utils';
|
||||
import { type UseFieldArrayReturn } from 'react-hook-form';
|
||||
import { type ChatBoxInputFormType, type UserInputFileItemType } from '../type';
|
||||
import { type AppFileSelectConfigType } from '@fastgpt/global/core/app/type';
|
||||
import { type AppFileSelectConfigType } from '@fastgpt/global/core/app/type/config';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
import { type OutLinkChatAuthProps } from '@fastgpt/global/support/permission/chat';
|
||||
import { getPresignedChatFileGetUrl, getUploadChatFilePresignedUrl } from '@/web/common/file/api';
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ import { chats2GPTMessages } from '@fastgpt/global/core/chat/adapt';
|
|||
import { clientGetWorkflowToolRunUserQuery } from '@fastgpt/global/core/workflow/utils';
|
||||
import { ChatItemContext } from '@/web/core/chat/context/chatItemContext';
|
||||
import { ChatRecordContext } from '@/web/core/chat/context/chatRecordContext';
|
||||
import { type AppFileSelectConfigType } from '@fastgpt/global/core/app/type';
|
||||
import { type AppFileSelectConfigType } from '@fastgpt/global/core/app/type/config';
|
||||
import { defaultAppSelectFileConfig } from '@fastgpt/global/core/app/constants';
|
||||
import { mergeChatResponseData } from '@fastgpt/global/core/chat/utils';
|
||||
import { getErrText } from '@fastgpt/global/common/error/utils';
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import React, { type ReactNode } from 'react';
|
|||
import { createContext } from 'use-context-selector';
|
||||
import { HelperBotTypeEnum } from '@fastgpt/global/core/chat/helperBot/type';
|
||||
import type { TopAgentParamsType } from '@fastgpt/global/core/chat/helperBot/topAgent/type';
|
||||
import type { AppFileSelectConfigType } from '@fastgpt/global/core/app/type';
|
||||
import { type AppFileSelectConfigType } from '@fastgpt/global/core/app/type/config';
|
||||
import type { TopAgentFormDataType } from '@fastgpt/service/core/chat/HelperBot/dispatch/topAgent/type';
|
||||
import type {
|
||||
GeneratedSkillResultType,
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import { clone } from 'lodash';
|
|||
import { getErrText } from '@fastgpt/global/common/error/utils';
|
||||
import { type UseFieldArrayReturn } from 'react-hook-form';
|
||||
import type { ChatBoxInputFormType, UserInputFileItemType } from '../../ChatContainer/ChatBox/type';
|
||||
import { type AppFileSelectConfigType } from '@fastgpt/global/core/app/type';
|
||||
import { type AppFileSelectConfigType } from '@fastgpt/global/core/app/type/config';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
import { type OutLinkChatAuthProps } from '@fastgpt/global/support/permission/chat';
|
||||
import { getPresignedChatFileGetUrl, getUploadChatFilePresignedUrl } from '@/web/common/file/api';
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import {
|
|||
IconButton,
|
||||
Textarea
|
||||
} from '@chakra-ui/react';
|
||||
import type { AppFileSelectConfigType } from '@fastgpt/global/core/app/type';
|
||||
import { type AppFileSelectConfigType } from '@fastgpt/global/core/app/type/config';
|
||||
import type { SkillEditType } from '@fastgpt/global/core/app/formEdit/type';
|
||||
import { useRouter } from 'next/router';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
|
|
|
|||
|
|
@ -56,12 +56,6 @@ export const appWorkflow2AgentForm = ({
|
|||
if (subApps) {
|
||||
defaultAppForm.selectedTools = subApps;
|
||||
}
|
||||
|
||||
// TODO: 临时存这里,后续会改成单独表存储
|
||||
const skills = inputMap.get(NodeInputKeyEnum.skills) as SkillEditType[];
|
||||
if (skills) {
|
||||
defaultAppForm.skills = skills;
|
||||
}
|
||||
} else if (node.flowNodeType === FlowNodeTypeEnum.systemConfig) {
|
||||
defaultAppForm.chatConfig = getAppChatConfig({
|
||||
chatConfig,
|
||||
|
|
@ -216,38 +210,6 @@ export function agentForm2AppWorkflow(
|
|||
return input;
|
||||
})
|
||||
}))
|
||||
},
|
||||
{
|
||||
key: NodeInputKeyEnum.skills,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.hidden], // Set in the pop-up window
|
||||
label: '',
|
||||
valueType: WorkflowIOValueTypeEnum.arrayObject,
|
||||
value: data.skills.map((skill) => ({
|
||||
...skill,
|
||||
selectedTools: skill.selectedTools.map((tool) => ({
|
||||
...tool,
|
||||
inputs: tool.inputs.map((input) => {
|
||||
// Special key value
|
||||
if (input.key === NodeInputKeyEnum.forbidStream) {
|
||||
input.value = true;
|
||||
}
|
||||
// Special tool
|
||||
if (
|
||||
tool.flowNodeType === FlowNodeTypeEnum.appModule &&
|
||||
input.key === NodeInputKeyEnum.history
|
||||
) {
|
||||
return {
|
||||
...input,
|
||||
value: data.aiSettings.maxHistories
|
||||
};
|
||||
}
|
||||
if (input.renderTypeList.includes(FlowNodeInputTypeEnum.fileSelect)) {
|
||||
input.value = [[workflowStartNodeId, NodeOutputKeyEnum.userFiles]];
|
||||
}
|
||||
return input;
|
||||
})
|
||||
}))
|
||||
}))
|
||||
}
|
||||
],
|
||||
outputs: AgentNode.outputs
|
||||
|
|
|
|||
|
|
@ -191,95 +191,6 @@ const AppCard = ({
|
|||
>
|
||||
{appDetail.intro || t('common:core.app.tip.Add a intro to app')}
|
||||
</Box>
|
||||
<HStack alignItems={'center'}>
|
||||
<Button
|
||||
size={['sm', 'md']}
|
||||
variant={'whitePrimary'}
|
||||
leftIcon={<MyIcon name={'core/chat/chatLight'} w={'16px'} />}
|
||||
onClick={() =>
|
||||
window.open(
|
||||
`/chat?appId=${appId}&pane=${ChatSidebarPaneEnum.RECENTLY_USED_APPS}`,
|
||||
'_blank'
|
||||
)
|
||||
}
|
||||
>
|
||||
{t('common:core.Chat')}
|
||||
</Button>
|
||||
{appDetail.permission.hasManagePer && (
|
||||
<Button
|
||||
size={['sm', 'md']}
|
||||
variant={'whitePrimary'}
|
||||
leftIcon={<MyIcon name={'common/settingLight'} w={'16px'} />}
|
||||
onClick={onOpenInfoEdit}
|
||||
>
|
||||
{t('common:Setting')}
|
||||
</Button>
|
||||
)}
|
||||
{appDetail.permission.isOwner && (
|
||||
<MyMenu
|
||||
size={'xs'}
|
||||
Button={
|
||||
<IconButton
|
||||
variant={'whitePrimary'}
|
||||
size={['smSquare', 'mdSquare']}
|
||||
icon={<MyIcon name={'more'} w={'1rem'} />}
|
||||
aria-label={''}
|
||||
/>
|
||||
}
|
||||
menuList={[
|
||||
{
|
||||
children: [
|
||||
{
|
||||
label: (
|
||||
<Flex>
|
||||
<ExportConfigPopover
|
||||
appName={appDetail.name}
|
||||
appForm={appForm}
|
||||
chatConfig={appDetail.chatConfig}
|
||||
/>
|
||||
</Flex>
|
||||
)
|
||||
},
|
||||
{
|
||||
icon: 'core/app/type/workflow',
|
||||
label: t('app:transition_to_workflow'),
|
||||
onClick: () => setTransitionCreateNew(true)
|
||||
},
|
||||
...(appDetail.permission.hasWritePer && feConfigs?.show_team_chat
|
||||
? [
|
||||
{
|
||||
icon: 'core/chat/fileSelect',
|
||||
label: t('app:team_tags_set'),
|
||||
onClick: () => setTeamTagsSet(appDetail)
|
||||
}
|
||||
]
|
||||
: [])
|
||||
]
|
||||
},
|
||||
{
|
||||
children: [
|
||||
{
|
||||
icon: 'delete',
|
||||
type: 'danger',
|
||||
label: t('common:Delete'),
|
||||
onClick: onDelApp
|
||||
}
|
||||
]
|
||||
}
|
||||
]}
|
||||
/>
|
||||
)}
|
||||
<Box flex={1} />
|
||||
{/* {isPc && ( */}
|
||||
{/* <MyTag */}
|
||||
{/* type="borderFill" */}
|
||||
{/* colorSchema="gray" */}
|
||||
{/* onClick={() => (appDetail.permission.hasManagePer ? onOpenInfoEdit() : undefined)} */}
|
||||
{/* > */}
|
||||
{/* <PermissionIconText defaultPermission={appDetail.defaultPermission} /> */}
|
||||
{/* </MyTag> */}
|
||||
{/* )} */}
|
||||
</HStack>
|
||||
</Box>
|
||||
{TeamTagsSet && <TagsEditModal onClose={() => setTeamTagsSet(undefined)} />}
|
||||
{transitionCreateNew !== undefined && (
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import MyIcon from '@fastgpt/web/components/common/Icon';
|
|||
import { useTranslation } from 'next-i18next';
|
||||
import QuestionTip from '@fastgpt/web/components/common/MyTooltip/QuestionTip';
|
||||
import { SmallAddIcon } from '@chakra-ui/icons';
|
||||
import type { AppFileSelectConfigType } from '@fastgpt/global/core/app/type';
|
||||
import { type AppFileSelectConfigType } from '@fastgpt/global/core/app/type/config';
|
||||
import type { AppFormEditFormType } from '@fastgpt/global/core/app/formEdit/type';
|
||||
import type { SelectedToolItemType } from '@fastgpt/global/core/app/formEdit/type';
|
||||
import MyTooltip from '@fastgpt/web/components/common/MyTooltip';
|
||||
|
|
|
|||
|
|
@ -36,11 +36,8 @@ import { getToolPreviewNode } from '@/web/core/app/api/tool';
|
|||
import type { FlowNodeTemplateType } from '@fastgpt/global/core/workflow/type/node';
|
||||
import { getWebLLMModel } from '@/web/common/system/utils';
|
||||
import { ChatSettingContext } from '@/web/core/chat/context/chatSettingContext';
|
||||
import type {
|
||||
AppFileSelectConfigType,
|
||||
AppListItemType,
|
||||
AppWhisperConfigType
|
||||
} from '@fastgpt/global/core/app/type';
|
||||
import type { AppListItemType, AppWhisperConfigType } from '@fastgpt/global/core/app/type';
|
||||
import { type AppFileSelectConfigType } from '@fastgpt/global/core/app/type/config';
|
||||
import ChatHeader from '@/pageComponents/chat/ChatHeader';
|
||||
import { ChatRecordContext } from '@/web/core/chat/context/chatRecordContext';
|
||||
import { ChatSidebarPaneEnum } from '../constants';
|
||||
|
|
|
|||
Loading…
Reference in New Issue