mirror of
https://github.com/labring/FastGPT.git
synced 2026-05-08 01:08:43 +08:00
refactor: useRequest2 -> useRequest (#6333)
This commit is contained in:
@@ -13,7 +13,7 @@ import {
|
||||
} from '@chakra-ui/react';
|
||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
import MyTooltip from '@fastgpt/web/components/common/MyTooltip';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import React, { useMemo } from 'react';
|
||||
import { getQuoteData } from '@/web/core/dataset/api';
|
||||
@@ -74,7 +74,7 @@ const CiteLink = React.memo(function CiteLink({
|
||||
data: datasetCiteData,
|
||||
loading,
|
||||
runAsync: getQuoteDataById
|
||||
} = useRequest2((id: string) => getQuoteData({ id, ...chatAuthData }), {
|
||||
} = useRequest((id: string) => getQuoteData({ id, ...chatAuthData }), {
|
||||
manual: true
|
||||
});
|
||||
const sourceData = useMemo(
|
||||
|
||||
@@ -6,7 +6,7 @@ import Avatar from '@fastgpt/web/components/common/Avatar';
|
||||
import MySelect, { type SelectProps } from '@fastgpt/web/components/common/MySelect';
|
||||
import MultipleRowSelect from '@fastgpt/web/components/common/MySelect/MultipleRowSelect';
|
||||
import MyTooltip from '@fastgpt/web/components/common/MyTooltip';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import React, { useCallback, useMemo, useState } from 'react';
|
||||
|
||||
@@ -35,7 +35,7 @@ const OneRowSelector = ({
|
||||
getMyModelList
|
||||
} = useSystemStore();
|
||||
|
||||
const { data: myModels } = useRequest2(
|
||||
const { data: myModels } = useRequest(
|
||||
async () => {
|
||||
const set = await getMyModelList();
|
||||
if (cacheModel) {
|
||||
@@ -154,7 +154,7 @@ const MultipleRowSelector = ({
|
||||
getMyModelList
|
||||
} = useSystemStore();
|
||||
|
||||
const { data: myModels } = useRequest2(getMyModelList, {
|
||||
const { data: myModels } = useRequest(getMyModelList, {
|
||||
manual: false
|
||||
});
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import React, { useCallback } from 'react';
|
||||
import { ModalFooter, ModalBody, Input, Button, Box, Textarea, HStack } from '@chakra-ui/react';
|
||||
import MyModal from '@fastgpt/web/components/common/MyModal/index';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import FormLabel from '@fastgpt/web/components/common/MyBox/FormLabel';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import MyTooltip from '@fastgpt/web/components/common/MyTooltip';
|
||||
@@ -33,7 +33,7 @@ const EditResourceModal = ({
|
||||
});
|
||||
const avatar = watch('avatar');
|
||||
|
||||
const { runAsync: onSave, loading } = useRequest2(
|
||||
const { runAsync: onSave, loading } = useRequest(
|
||||
(data: EditResourceInfoFormType) => onEdit(data),
|
||||
{
|
||||
onSuccess: (res) => {
|
||||
|
||||
@@ -7,7 +7,7 @@ import MyPopover from '@fastgpt/web/components/common/MyPopover';
|
||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
import MyModal from '@fastgpt/web/components/common/MyModal';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useLocalStorageState } from 'ahooks';
|
||||
import AIModelSelector from '../../../Select/AIModelSelector';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
@@ -78,7 +78,7 @@ const OptimizerPopover = ({
|
||||
return !optimizerInput.trim();
|
||||
}, [optimizerInput]);
|
||||
|
||||
const { runAsync: handleSendOptimization, loading } = useRequest2(async (isAuto?: boolean) => {
|
||||
const { runAsync: handleSendOptimization, loading } = useRequest(async (isAuto?: boolean) => {
|
||||
if (isEmptyOptimizerInput && !isAuto) return;
|
||||
|
||||
setOptimizedResult('');
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
import { useMemoizedFn, useMount } from 'ahooks';
|
||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
import { FolderIcon } from '@fastgpt/global/common/file/image/constants';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import LightTip from '@fastgpt/web/components/common/LightTip';
|
||||
|
||||
type FolderItemType = {
|
||||
@@ -37,7 +37,7 @@ const MoveModal = ({ moveResourceId, title, server, onConfirm, onClose, moveHint
|
||||
const [requestingIdList, setRequestingIdList] = useState<ParentIdType[]>([]);
|
||||
const [folderList, setFolderList] = useState<FolderItemType[]>([]);
|
||||
|
||||
const { runAsync: requestServer } = useRequest2((e: GetResourceFolderListProps) => {
|
||||
const { runAsync: requestServer } = useRequest((e: GetResourceFolderListProps) => {
|
||||
if (requestingIdList.includes(e.parentId)) return Promise.reject(null);
|
||||
|
||||
setRequestingIdList((state) => [...state, e.parentId]);
|
||||
@@ -147,7 +147,7 @@ const MoveModal = ({ moveResourceId, title, server, onConfirm, onClose, moveHint
|
||||
}
|
||||
);
|
||||
|
||||
const { runAsync: onConfirmSelect, loading: confirming } = useRequest2(
|
||||
const { runAsync: onConfirmSelect, loading: confirming } = useRequest(
|
||||
() => {
|
||||
if (selectedId) {
|
||||
return onConfirm(selectedId === rootId ? null : selectedId);
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
import Loading from '@fastgpt/web/components/common/MyLoading';
|
||||
import Avatar from '@fastgpt/web/components/common/Avatar';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useMemoizedFn } from 'ahooks';
|
||||
import { FolderImgUrl } from '@fastgpt/global/common/file/image/constants';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
@@ -47,7 +47,7 @@ const SelectOneResource = ({
|
||||
return [root];
|
||||
}, [dataList, t]);
|
||||
|
||||
const { runAsync: requestServer } = useRequest2((e: GetResourceFolderListProps) => {
|
||||
const { runAsync: requestServer } = useRequest((e: GetResourceFolderListProps) => {
|
||||
if (requestingIdList.includes(e.parentId)) return Promise.reject(null);
|
||||
|
||||
setRequestingIdList((state) => [...state, e.parentId]);
|
||||
@@ -56,7 +56,7 @@ const SelectOneResource = ({
|
||||
);
|
||||
}, {});
|
||||
|
||||
const { loading } = useRequest2(() => requestServer({ parentId: null }), {
|
||||
const { loading } = useRequest(() => requestServer({ parentId: null }), {
|
||||
manual: false,
|
||||
onSuccess: (data) => {
|
||||
setDataList(
|
||||
|
||||
@@ -32,7 +32,7 @@ import EmptyTip from '@fastgpt/web/components/common/EmptyTip';
|
||||
import { useToast } from '@fastgpt/web/hooks/useToast';
|
||||
import { useSelectFile } from '@/web/common/file/hooks/useSelectFile';
|
||||
import { readCsvRawText } from '@fastgpt/web/common/file/utils';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import HighlightText from '@fastgpt/web/components/common/String/HighlightText';
|
||||
import { defaultChatInputGuideConfig } from '@fastgpt/global/core/app/constants';
|
||||
import ChatFunctionTip from './Tip';
|
||||
@@ -214,7 +214,7 @@ const LexiconConfigModal = ({ appId, onClose }: { appId: string; onClose: () =>
|
||||
}
|
||||
});
|
||||
|
||||
const { run: createNewData, loading: isCreating } = useRequest2(
|
||||
const { run: createNewData, loading: isCreating } = useRequest(
|
||||
async (textList: string[]) => {
|
||||
if (textList.filter(Boolean).length === 0) {
|
||||
return Promise.resolve();
|
||||
|
||||
@@ -4,7 +4,7 @@ import React, { useRef, useCallback, useMemo, useState } from 'react';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import MyTooltip from '@fastgpt/web/components/common/MyTooltip';
|
||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { type ChatBoxInputFormType, type ChatBoxInputType, type SendPromptFnType } from '../type';
|
||||
import { textareaMinH } from '../constants';
|
||||
import { useFieldArray, type UseFormReturn } from 'react-hook-form';
|
||||
@@ -106,7 +106,7 @@ const ChatInput = ({
|
||||
showSelectCustomFileExtension;
|
||||
|
||||
// Upload files
|
||||
useRequest2(uploadFiles, {
|
||||
useRequest(uploadFiles, {
|
||||
manual: false,
|
||||
errorToast: t('common:upload_file_error'),
|
||||
refreshDeps: [fileList, outLinkAuthData, chatId]
|
||||
@@ -126,7 +126,7 @@ const ChatInput = ({
|
||||
},
|
||||
[TextareaDom, canSendMessage, fileList, onSendMessage, replaceFiles]
|
||||
);
|
||||
const { runAsync: handleStop, loading: isStopping } = useRequest2(async () => {
|
||||
const { runAsync: handleStop, loading: isStopping } = useRequest(async () => {
|
||||
try {
|
||||
if (isChatting) {
|
||||
await postStopV2Chat({
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Box, Flex } from '@chakra-ui/react';
|
||||
import React from 'react';
|
||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { queryChatInputGuideList } from '@/web/core/chat/inputGuide/api';
|
||||
import MyTooltip from '@fastgpt/web/components/common/MyTooltip';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
@@ -25,7 +25,7 @@ export default function InputGuideBox({
|
||||
const chatInputGuide = useContextSelector(ChatBoxContext, (v) => v.chatInputGuide);
|
||||
const outLinkAuthData = useContextSelector(WorkflowRuntimeContext, (v) => v.outLinkAuthData);
|
||||
|
||||
const { data = [] } = useRequest2(
|
||||
const { data = [] } = useRequest(
|
||||
async () => {
|
||||
if (!text) return [];
|
||||
// More than 20 characters, it's basically meaningless
|
||||
|
||||
+2
-2
@@ -11,7 +11,7 @@ import { ChatBoxContext } from '../Provider';
|
||||
import { useContextSelector } from 'use-context-selector';
|
||||
import MyImage from '@fastgpt/web/components/common/Image/MyImage';
|
||||
import { ChatRecordContext } from '@/web/core/chat/context/chatRecordContext';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { eventBus, EventNameEnum } from '@/web/common/utils/eventbus';
|
||||
|
||||
export type ChatControllerProps = {
|
||||
@@ -75,7 +75,7 @@ const ChatController = ({
|
||||
const {
|
||||
runAsync: requestOnToggleFeedbackReadStatus,
|
||||
loading: isLoadingOnToggleFeedbackReadStatus
|
||||
} = useRequest2(async () => onToggleFeedbackReadStatus?.(), {
|
||||
} = useRequest(async () => onToggleFeedbackReadStatus?.(), {
|
||||
manual: true,
|
||||
onSuccess: () => {
|
||||
eventBus.emit(EventNameEnum.refreshFeedback);
|
||||
|
||||
+2
-2
@@ -5,7 +5,7 @@ import { useContextSelector } from 'use-context-selector';
|
||||
import { ChatBoxContext } from '../Provider';
|
||||
import { type ChatHistoryItemResType } from '@fastgpt/global/core/chat/type';
|
||||
import { FlowNodeTypeEnum } from '@fastgpt/global/core/workflow/node/constant';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { getFlatAppResponses } from '@/global/core/chat/utils';
|
||||
const isLLMNode = (item: ChatHistoryItemResType) =>
|
||||
@@ -14,7 +14,7 @@ const isLLMNode = (item: ChatHistoryItemResType) =>
|
||||
const ContextModal = ({ onClose, dataId }: { onClose: () => void; dataId: string }) => {
|
||||
const { getHistoryResponseData } = useContextSelector(ChatBoxContext, (v) => v);
|
||||
const { t } = useTranslation();
|
||||
const { loading: isLoading, data: contextModalData } = useRequest2(
|
||||
const { loading: isLoading, data: contextModalData } = useRequest(
|
||||
() =>
|
||||
getHistoryResponseData({ dataId }).then((res) => {
|
||||
const flatResData = getFlatAppResponses(res || []);
|
||||
|
||||
+11
-9
@@ -24,8 +24,8 @@ const FeedbackModal = ({
|
||||
const { t } = useTranslation();
|
||||
const outLinkAuthData = useContextSelector(WorkflowRuntimeContext, (v) => v.outLinkAuthData);
|
||||
|
||||
const { mutate, isLoading } = useRequest({
|
||||
mutationFn: async () => {
|
||||
const { runAsync, loading: isLoading } = useRequest(
|
||||
async () => {
|
||||
const val = ref.current?.value || t('common:core.chat.feedback.No Content');
|
||||
return updateChatUserFeedback({
|
||||
appId,
|
||||
@@ -35,12 +35,14 @@ const FeedbackModal = ({
|
||||
...outLinkAuthData
|
||||
});
|
||||
},
|
||||
onSuccess() {
|
||||
onSuccess(ref.current?.value || t('common:core.chat.feedback.No Content'));
|
||||
},
|
||||
successToast: t('common:core.chat.Feedback Success'),
|
||||
errorToast: t('common:core.chat.Feedback Failed')
|
||||
});
|
||||
{
|
||||
onSuccess() {
|
||||
onSuccess(ref.current?.value || t('common:core.chat.feedback.No Content'));
|
||||
},
|
||||
successToast: t('common:core.chat.Feedback Success'),
|
||||
errorToast: t('common:core.chat.Feedback Failed')
|
||||
}
|
||||
);
|
||||
|
||||
return (
|
||||
<MyModal
|
||||
@@ -56,7 +58,7 @@ const FeedbackModal = ({
|
||||
<Button variant={'whiteBase'} mr={2} onClick={onClose}>
|
||||
{t('common:Close')}
|
||||
</Button>
|
||||
<Button isLoading={isLoading} onClick={mutate}>
|
||||
<Button isLoading={isLoading} onClick={runAsync}>
|
||||
{t('common:core.chat.Feedback Submit')}
|
||||
</Button>
|
||||
</ModalFooter>
|
||||
|
||||
+2
-2
@@ -6,7 +6,7 @@ import QuoteItem, { formatScore } from '@/components/core/dataset/QuoteItem';
|
||||
import { useContextSelector } from 'use-context-selector';
|
||||
import { WorkflowRuntimeContext } from '../../context/workflowRuntimeContext';
|
||||
import { ChatItemContext } from '@/web/core/chat/context/chatItemContext';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useChatStore } from '@/web/core/chat/context/useChatStore';
|
||||
import { getQuoteDataList } from '@/web/core/chat/api';
|
||||
|
||||
@@ -32,7 +32,7 @@ const QuoteList = React.memo(function QuoteList({
|
||||
(v) => v.showRouteToDatasetDetail
|
||||
);
|
||||
|
||||
const { data: quoteList } = useRequest2(
|
||||
const { data: quoteList } = useRequest(
|
||||
async () =>
|
||||
!!chatItemDataId
|
||||
? await getQuoteDataList({
|
||||
|
||||
+2
-2
@@ -7,7 +7,7 @@ import { PluginRunContext } from '../context';
|
||||
import Markdown from '@/components/Markdown';
|
||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
import FormLabel from '@fastgpt/web/components/common/MyBox/FormLabel';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useFileUpload } from '../../ChatBox/hooks/useFileUpload';
|
||||
import FilePreview from '../../components/FilePreview';
|
||||
import { type UserChatItemValueItemType } from '@fastgpt/global/core/chat/type';
|
||||
@@ -70,7 +70,7 @@ const RenderInput = () => {
|
||||
appId,
|
||||
chatId
|
||||
});
|
||||
useRequest2(uploadFiles, {
|
||||
useRequest(uploadFiles, {
|
||||
manual: false,
|
||||
errorToast: t('common:upload_file_error'),
|
||||
refreshDeps: [fileList, outLinkAuthData]
|
||||
|
||||
@@ -13,7 +13,7 @@ import { useSystem } from '@fastgpt/web/hooks/useSystem';
|
||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
import { useContextSelector } from 'use-context-selector';
|
||||
import { ChatBoxContext } from '../ChatContainer/ChatBox/Provider';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { getFileIcon } from '@fastgpt/global/common/file/icon';
|
||||
import EmptyTip from '@fastgpt/web/components/common/EmptyTip';
|
||||
import { completionFinishReasonMap } from '@fastgpt/global/core/ai/constants';
|
||||
@@ -819,7 +819,7 @@ const WholeResponseModal = ({
|
||||
const { t } = useSafeTranslation();
|
||||
|
||||
const { getHistoryResponseData } = useContextSelector(ChatBoxContext, (v) => v);
|
||||
const { loading: isLoading, data: response } = useRequest2(
|
||||
const { loading: isLoading, data: response } = useRequest(
|
||||
() => getHistoryResponseData({ dataId }),
|
||||
{
|
||||
manual: false
|
||||
|
||||
@@ -6,7 +6,7 @@ import { useTranslation } from 'next-i18next';
|
||||
import { Box } from '@chakra-ui/react';
|
||||
import FolderPath from '@/components/common/folder/Path';
|
||||
import MyBox from '@fastgpt/web/components/common/MyBox';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
|
||||
type PathItemType = {
|
||||
parentId: string;
|
||||
@@ -79,7 +79,7 @@ export function useDatasetSelect() {
|
||||
},
|
||||
loading: isFetching,
|
||||
runAsync: loadDatasets
|
||||
} = useRequest2(
|
||||
} = useRequest(
|
||||
async () => {
|
||||
const result = await Promise.all([
|
||||
getDatasets({ parentId, searchKey }),
|
||||
|
||||
@@ -2,7 +2,7 @@ import React, { useCallback, useMemo } from 'react';
|
||||
import { useDisclosure } from '@chakra-ui/react';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { getActivityAd } from '@/web/common/system/api';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import {
|
||||
Box,
|
||||
Flex,
|
||||
@@ -33,7 +33,7 @@ const ActivityAdModal = () => {
|
||||
listenStorageChange: true
|
||||
});
|
||||
|
||||
const { data } = useRequest2(
|
||||
const { data } = useRequest(
|
||||
async () => {
|
||||
if (!feConfigs?.isPlus || !userInfo) return;
|
||||
return getActivityAd();
|
||||
|
||||
@@ -32,7 +32,7 @@ import { useTranslation } from 'next-i18next';
|
||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
import MyModal from '@fastgpt/web/components/common/MyModal';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { useRequest, useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { getDocPath } from '@/web/common/system/doc';
|
||||
import MyMenu from '@fastgpt/web/components/common/MyMenu';
|
||||
import { useConfirm } from '@fastgpt/web/hooks/useConfirm';
|
||||
@@ -62,7 +62,7 @@ const ApiKeyTable = ({ tips, appId }: { tips: string; appId?: string }) => {
|
||||
content: t('common:delete_api')
|
||||
});
|
||||
|
||||
const { runAsync: onclickRemove } = useRequest2(delOpenApiById, {
|
||||
const { runAsync: onclickRemove } = useRequest(delOpenApiById, {
|
||||
onSuccess() {
|
||||
refetch();
|
||||
}
|
||||
@@ -72,7 +72,7 @@ const ApiKeyTable = ({ tips, appId }: { tips: string; appId?: string }) => {
|
||||
data: apiKeys = [],
|
||||
loading: isGetting,
|
||||
run: refetch
|
||||
} = useRequest2(() => getOpenApiKeys({ appId }), {
|
||||
} = useRequest(() => getOpenApiKeys({ appId }), {
|
||||
manual: false,
|
||||
refreshDeps: [appId]
|
||||
});
|
||||
@@ -316,19 +316,24 @@ function EditKeyModal({
|
||||
defaultValues: defaultData
|
||||
});
|
||||
|
||||
const { mutate: onclickCreate, isLoading: creating } = useRequest({
|
||||
mutationFn: async (e: EditProps) => createAOpenApiKey(e),
|
||||
errorToast: t('workflow:create_link_error'),
|
||||
onSuccess: onCreate
|
||||
});
|
||||
const { mutate: onclickUpdate, isLoading: updating } = useRequest({
|
||||
mutationFn: (e: EditProps) => {
|
||||
const { runAsync: onclickCreate, loading: creating } = useRequest(
|
||||
async (e: EditProps) => createAOpenApiKey(e),
|
||||
{
|
||||
errorToast: t('workflow:create_link_error'),
|
||||
onSuccess: onCreate
|
||||
}
|
||||
);
|
||||
|
||||
const { runAsync: onclickUpdate, loading: updating } = useRequest(
|
||||
(e: EditProps) => {
|
||||
//@ts-ignore
|
||||
return putOpenApiKey(e);
|
||||
},
|
||||
errorToast: t('workflow:update_link_error'),
|
||||
onSuccess: onEdit
|
||||
});
|
||||
{
|
||||
errorToast: t('workflow:update_link_error'),
|
||||
onSuccess: onEdit
|
||||
}
|
||||
);
|
||||
|
||||
return (
|
||||
<MyModal
|
||||
|
||||
@@ -50,13 +50,15 @@ const LafAccountModal = ({
|
||||
});
|
||||
}, [reset]);
|
||||
|
||||
const { mutate: authLafPat, isLoading: isPatLoading } = useRequest({
|
||||
mutationFn: async (pat) => {
|
||||
const { runAsync: authLafPat, loading: isPatLoading } = useRequest(
|
||||
async (pat) => {
|
||||
const token = await postLafPat2Token(pat);
|
||||
setValue('token', token);
|
||||
},
|
||||
errorToast: t('common:plugin.Invalid Env')
|
||||
});
|
||||
{
|
||||
errorToast: t('common:plugin.Invalid Env')
|
||||
}
|
||||
);
|
||||
|
||||
const { data: appListData = [] } = useQuery(
|
||||
['appList', lafToken],
|
||||
@@ -80,20 +82,22 @@ const LafAccountModal = ({
|
||||
}
|
||||
);
|
||||
|
||||
const { mutate: onSubmit, isLoading: isUpdating } = useRequest({
|
||||
mutationFn: async (data: LafAccountType) => {
|
||||
const { runAsync: onSubmit, loading: isUpdating } = useRequest(
|
||||
async (data: LafAccountType) => {
|
||||
if (!userInfo?.team.teamId) return;
|
||||
return putUpdateTeam({
|
||||
lafAccount: data
|
||||
});
|
||||
},
|
||||
onSuccess() {
|
||||
initUserInfo();
|
||||
onClose();
|
||||
},
|
||||
successToast: t('common:update_success'),
|
||||
errorToast: t('common:update_failed')
|
||||
});
|
||||
{
|
||||
onSuccess() {
|
||||
initUserInfo();
|
||||
onClose();
|
||||
},
|
||||
successToast: t('common:update_success'),
|
||||
errorToast: t('common:update_failed')
|
||||
}
|
||||
);
|
||||
|
||||
return (
|
||||
<MyModal isOpen iconSrc="support/account/laf" title={t('common:user.Laf Account Setting')}>
|
||||
|
||||
@@ -15,7 +15,7 @@ import Avatar from '@fastgpt/web/components/common/Avatar';
|
||||
import Icon from '@fastgpt/web/components/common/Icon';
|
||||
import MyModal from '@fastgpt/web/components/common/MyModal';
|
||||
import MyTag from '@fastgpt/web/components/common/Tag';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useScrollPagination } from '@fastgpt/web/hooks/useScrollPagination';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import React, { useState } from 'react';
|
||||
@@ -39,7 +39,7 @@ export function ChangeOwnerModal({
|
||||
pageSize: 15
|
||||
});
|
||||
|
||||
const { data: searchedData } = useRequest2(
|
||||
const { data: searchedData } = useRequest(
|
||||
async () => {
|
||||
if (!inputValue) return;
|
||||
return GetSearchUserGroupOrg(inputValue);
|
||||
@@ -63,7 +63,7 @@ export function ChangeOwnerModal({
|
||||
'permission' | 'teamId'
|
||||
> | null>(null);
|
||||
|
||||
const { runAsync, loading } = useRequest2(onChangeOwner, {
|
||||
const { runAsync, loading } = useRequest(onChangeOwner, {
|
||||
onSuccess: onClose,
|
||||
successToast: t('common:permission.change_owner_success'),
|
||||
errorToast: t('common:permission.change_owner_failed')
|
||||
|
||||
@@ -3,7 +3,7 @@ import MySelect from '@fastgpt/web/components/common/MySelect';
|
||||
import React from 'react';
|
||||
import type { PermissionValueType } from '@fastgpt/global/support/permission/type';
|
||||
import { ReadPermissionVal, WritePermissionVal } from '@fastgpt/global/support/permission/constant';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useConfirm } from '@fastgpt/web/hooks/useConfirm';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
|
||||
@@ -41,7 +41,7 @@ const DefaultPermissionList = ({
|
||||
{ label: t('user:permission.team_write'), value: writePer }
|
||||
];
|
||||
|
||||
const { runAsync: onRequestChange } = useRequest2((v: PermissionValueType) => onChange(v));
|
||||
const { runAsync: onRequestChange } = useRequest((v: PermissionValueType) => onChange(v));
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -15,7 +15,7 @@ import MyAvatar from '@fastgpt/web/components/common/Avatar';
|
||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
import SearchInput from '@fastgpt/web/components/common/Input/SearchInput';
|
||||
import MyModal from '@fastgpt/web/components/common/MyModal';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useScrollPagination } from '@fastgpt/web/hooks/useScrollPagination';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
@@ -76,7 +76,7 @@ function MemberModal({
|
||||
refreshDeps: [debouncedSearchKey]
|
||||
});
|
||||
|
||||
const { data: groups = [], loading: loadingGroupsAndOrgs } = useRequest2(
|
||||
const { data: groups = [], loading: loadingGroupsAndOrgs } = useRequest(
|
||||
async () => {
|
||||
if (!userInfo?.team?.teamId) return [];
|
||||
return getGroupList<false>({
|
||||
@@ -104,7 +104,7 @@ function MemberModal({
|
||||
const parentClbs = useContextSelector(CollaboratorContext, (v) => v.parentClbList);
|
||||
const myRole = useContextSelector(CollaboratorContext, (v) => v.myRole);
|
||||
|
||||
const { runAsync: _onConfirm, loading: isUpdating } = useRequest2(
|
||||
const { runAsync: _onConfirm, loading: isUpdating } = useRequest(
|
||||
() =>
|
||||
onUpdateCollaborators({
|
||||
collaborators: editCollaborators.map(
|
||||
|
||||
@@ -15,7 +15,7 @@ import { createContext } from 'use-context-selector';
|
||||
import dynamic from 'next/dynamic';
|
||||
|
||||
import MemberListCard, { type MemberListCardProps } from './MemberListCard';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
import type { RequireOnlyOne } from '@fastgpt/global/common/type/utils';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
@@ -121,7 +121,7 @@ const CollaboratorContextProvider = ({
|
||||
},
|
||||
runAsync: refetchCollaboratorList,
|
||||
loading: isFetchingCollaborator
|
||||
} = useRequest2(
|
||||
} = useRequest(
|
||||
async () => {
|
||||
if (feConfigs.isPlus) {
|
||||
const { clbs, parentClbs = [] } = await onGetCollaboratorList();
|
||||
|
||||
@@ -13,15 +13,17 @@ const ImportantInform = ({
|
||||
informs: UserInformSchema[];
|
||||
refetch: () => void;
|
||||
}) => {
|
||||
const { mutate: onClickClose } = useRequest({
|
||||
mutationFn: async (id: string) => {
|
||||
const { runAsync: onClickClose } = useRequest(
|
||||
async (id: string) => {
|
||||
await readInform(id);
|
||||
},
|
||||
onSuccess: () => {
|
||||
refetch();
|
||||
},
|
||||
errorToast: 'Failed to read the inform'
|
||||
});
|
||||
{
|
||||
onSuccess: () => {
|
||||
refetch();
|
||||
},
|
||||
errorToast: 'Failed to read the inform'
|
||||
}
|
||||
);
|
||||
|
||||
return (
|
||||
<Box position={'fixed'} top={'3%'} left={'50%'} transform={'translateX(-50%)'} zIndex={99999}>
|
||||
|
||||
@@ -6,7 +6,7 @@ import { useTranslation } from 'next-i18next';
|
||||
import { LOGO_ICON } from '@fastgpt/global/common/system/constants';
|
||||
import { getSystemMsgModalData } from '@/web/support/user/inform/api';
|
||||
import dynamic from 'next/dynamic';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { webPushTrack } from '@/web/common/middle/tracks/utils';
|
||||
const Markdown = dynamic(() => import('@/components/Markdown'), { ssr: false });
|
||||
|
||||
@@ -16,7 +16,7 @@ const SystemMsgModal = ({}: {}) => {
|
||||
|
||||
const { isOpen, onOpen, onClose } = useDisclosure();
|
||||
|
||||
const { data } = useRequest2(
|
||||
const { data } = useRequest(
|
||||
async () => {
|
||||
if (!userInfo?._id) {
|
||||
return;
|
||||
|
||||
@@ -3,7 +3,7 @@ import { ModalBody, Box, Flex, Input, ModalFooter, Button, HStack } from '@chakr
|
||||
import MyModal from '@fastgpt/web/components/common/MyModal';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { updateContact, updateNotificationAccount } from '@/web/support/user/api';
|
||||
import Icon from '@fastgpt/web/components/common/Icon';
|
||||
import { useSendCode } from '@/web/support/user/hooks/useSendCode';
|
||||
@@ -38,7 +38,7 @@ const UpdateContactModal = ({
|
||||
const account = watch('contact');
|
||||
const verifyCode = watch('verifyCode');
|
||||
|
||||
const { runAsync: onSubmit, loading: isLoading } = useRequest2(
|
||||
const { runAsync: onSubmit, loading: isLoading } = useRequest(
|
||||
async (data: FormType) => {
|
||||
if (mode === 'contact') {
|
||||
await updateContact(data);
|
||||
|
||||
@@ -3,7 +3,7 @@ import { ModalBody, Box, Flex, Input, ModalFooter, Button, HStack } from '@chakr
|
||||
import MyModal from '@fastgpt/web/components/common/MyModal';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { resetPassword, getCheckPswExpired } from '@/web/support/user/api';
|
||||
import { checkPasswordRule } from '@fastgpt/global/common/string/password';
|
||||
import { useToast } from '@fastgpt/web/hooks/useToast';
|
||||
@@ -31,7 +31,7 @@ const ResetPswModal = () => {
|
||||
data: passwordExpired = false,
|
||||
runAsync,
|
||||
loading: isFetching
|
||||
} = useRequest2(
|
||||
} = useRequest(
|
||||
async () => {
|
||||
if (!userInfo?._id) {
|
||||
return false;
|
||||
@@ -44,7 +44,7 @@ const ResetPswModal = () => {
|
||||
}
|
||||
);
|
||||
|
||||
const { runAsync: onSubmit, loading: isSubmitting } = useRequest2(resetPassword, {
|
||||
const { runAsync: onSubmit, loading: isSubmitting } = useRequest(resetPassword, {
|
||||
onSuccess() {
|
||||
runAsync();
|
||||
},
|
||||
|
||||
@@ -2,7 +2,7 @@ import { getCaptchaPic } from '@/web/support/user/api';
|
||||
import { Button, Input, ModalBody, ModalFooter, Skeleton } from '@chakra-ui/react';
|
||||
import MyImage from '@fastgpt/web/components/common/Image/MyImage';
|
||||
import MyModal from '@fastgpt/web/components/common/MyModal';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { useForm } from 'react-hook-form';
|
||||
|
||||
@@ -30,7 +30,7 @@ const SendCodeAuthModal = ({
|
||||
data,
|
||||
loading,
|
||||
runAsync: getCaptcha
|
||||
} = useRequest2(() => getCaptchaPic(username), { manual: false });
|
||||
} = useRequest(() => getCaptchaPic(username), { manual: false });
|
||||
|
||||
const onSubmit = async ({ code }: { code: string }) => {
|
||||
await onSendCode({ username, captcha: code });
|
||||
|
||||
@@ -55,23 +55,27 @@ const TeamTagsAsync = ({ onClose }: { onClose: () => void }) => {
|
||||
const linkUrl = `${baseUrl}/chat/team?teamId=${teamInfo.teamId}&teamToken=`;
|
||||
|
||||
// tags Async
|
||||
const { mutate: onclickUpdate, isLoading: isUpdating } = useRequest({
|
||||
mutationFn: async (data: FormType) => {
|
||||
const { runAsync: onclickUpdate, loading: isUpdating } = useRequest(
|
||||
async (data: FormType) => {
|
||||
return putUpdateTeam({ teamDomain: data.teamDomain });
|
||||
},
|
||||
onSuccess() {
|
||||
initUserInfo();
|
||||
onClose();
|
||||
},
|
||||
errorToast: t('common:create_failed')
|
||||
});
|
||||
const { mutate: onclickTagAsync, isLoading: isSyncing } = useRequest({
|
||||
mutationFn: (data: FormType) => loadTeamTagsByDomain(data.teamDomain),
|
||||
onSuccess(res) {
|
||||
replaceTeamTags(res);
|
||||
},
|
||||
successToast: t('common:support.user.team.Team Tags Async Success')
|
||||
});
|
||||
{
|
||||
onSuccess() {
|
||||
initUserInfo();
|
||||
onClose();
|
||||
},
|
||||
errorToast: t('common:create_failed')
|
||||
}
|
||||
);
|
||||
const { runAsync: onclickTagAsync, loading: isSyncing } = useRequest(
|
||||
(data: FormType) => loadTeamTagsByDomain(data.teamDomain),
|
||||
{
|
||||
onSuccess(res) {
|
||||
replaceTeamTags(res);
|
||||
},
|
||||
successToast: t('common:support.user.team.Team Tags Async Success')
|
||||
}
|
||||
);
|
||||
|
||||
useQuery(['getTeamsTags'], getTeamsTags, {
|
||||
onSuccess: (data) => {
|
||||
|
||||
@@ -5,7 +5,7 @@ import { Box, ModalBody, Flex, Button, Text, Link } from '@chakra-ui/react';
|
||||
import { checkBalancePayResult, putUpdatePayment } from '@/web/support/wallet/bill/api';
|
||||
import LightTip from '@fastgpt/web/components/common/LightTip';
|
||||
import QRCode from 'qrcode';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import {
|
||||
BillPayWayEnum,
|
||||
BillStatusEnum,
|
||||
@@ -79,7 +79,7 @@ const QRCodePayModal = ({
|
||||
});
|
||||
|
||||
const [selectedPayment, setSelectedPayment] = useState(payment);
|
||||
const { runAsync: handlePaymentChange, loading: isUpdating } = useRequest2(
|
||||
const { runAsync: handlePaymentChange, loading: isUpdating } = useRequest(
|
||||
async (newPayment: BillPayWayEnum) => {
|
||||
if (newPayment === selectedPayment) {
|
||||
return;
|
||||
@@ -95,7 +95,7 @@ const QRCodePayModal = ({
|
||||
);
|
||||
|
||||
// Check pay result
|
||||
useRequest2(() => checkBalancePayResult(billId), {
|
||||
useRequest(() => checkBalancePayResult(billId), {
|
||||
manual: false,
|
||||
pollingInterval: 2000,
|
||||
onSuccess: ({ status, description }) => {
|
||||
|
||||
@@ -4,7 +4,7 @@ import { useUserStore } from '@/web/support/user/useUserStore';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { getTeamList, putSwitchTeam } from '@/web/support/user/team/api';
|
||||
import { TeamMemberStatusEnum } from '@fastgpt/global/support/user/team/constant';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import MySelect from '@fastgpt/web/components/common/MySelect';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
import { useRouter } from 'next/router';
|
||||
@@ -24,12 +24,12 @@ const TeamSelector = ({
|
||||
const { userInfo } = useUserStore();
|
||||
const { setLoading } = useSystemStore();
|
||||
|
||||
const { data: myTeams = [] } = useRequest2(() => getTeamList(TeamMemberStatusEnum.active), {
|
||||
const { data: myTeams = [] } = useRequest(() => getTeamList(TeamMemberStatusEnum.active), {
|
||||
manual: false,
|
||||
refreshDeps: [userInfo]
|
||||
});
|
||||
|
||||
const { runAsync: onSwitchTeam } = useRequest2(
|
||||
const { runAsync: onSwitchTeam } = useRequest(
|
||||
async (teamId: string) => {
|
||||
setLoading(true);
|
||||
await putSwitchTeam(teamId);
|
||||
|
||||
@@ -22,7 +22,7 @@ import {
|
||||
import { billTypeMap } from '@fastgpt/global/support/wallet/bill/constants';
|
||||
import { formatStorePrice2Read } from '@fastgpt/global/support/wallet/usage/tools';
|
||||
import MyModal from '@fastgpt/web/components/common/MyModal';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import dayjs from 'dayjs';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { useCallback, useState } from 'react';
|
||||
@@ -57,7 +57,7 @@ const ApplyInvoiceModal = ({ onClose }: { onClose: () => void }) => {
|
||||
loading: isLoading,
|
||||
data: billsList,
|
||||
run: getInvoiceBills
|
||||
} = useRequest2(() => getInvoiceBillsList(), {
|
||||
} = useRequest(() => getInvoiceBillsList(), {
|
||||
manual: false
|
||||
});
|
||||
|
||||
@@ -72,7 +72,7 @@ const ApplyInvoiceModal = ({ onClose }: { onClose: () => void }) => {
|
||||
[chosenBillDataList]
|
||||
);
|
||||
|
||||
const { runAsync: onSubmitApply, loading: isSubmitting } = useRequest2(
|
||||
const { runAsync: onSubmitApply, loading: isSubmitting } = useRequest(
|
||||
(data) =>
|
||||
submitInvoice({
|
||||
amount: totalPrice,
|
||||
@@ -104,7 +104,7 @@ const ApplyInvoiceModal = ({ onClose }: { onClose: () => void }) => {
|
||||
}
|
||||
});
|
||||
|
||||
const { loading: isLoadingHeader } = useRequest2(() => getTeamInvoiceHeader(), {
|
||||
const { loading: isLoadingHeader } = useRequest(() => getTeamInvoiceHeader(), {
|
||||
manual: false,
|
||||
onSuccess: (res) => inputForm.reset(res)
|
||||
});
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
} from '@fastgpt/global/support/wallet/bill/constants';
|
||||
import { formatStorePrice2Read } from '@fastgpt/global/support/wallet/usage/tools';
|
||||
import { standardSubLevelMap, subModeMap } from '@fastgpt/global/support/wallet/sub/constants';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { getBillDetail } from '@/web/support/wallet/bill/api';
|
||||
import { i18nT } from '@fastgpt/web/i18n/utils';
|
||||
|
||||
@@ -23,7 +23,7 @@ type BillDetailModalProps = {
|
||||
const BillDetailModal = ({ billId, onClose }: BillDetailModalProps) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const { data: bill, loading } = useRequest2(() => getBillDetail(billId), {
|
||||
const { data: bill, loading } = useRequest(() => getBillDetail(billId), {
|
||||
refreshDeps: [billId],
|
||||
manual: false
|
||||
});
|
||||
|
||||
@@ -29,7 +29,7 @@ import {
|
||||
billTypeMap
|
||||
} from '@fastgpt/global/support/wallet/bill/constants';
|
||||
import MyBox from '@fastgpt/web/components/common/MyBox';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import MySelect from '@fastgpt/web/components/common/MySelect';
|
||||
import { usePagination } from '@fastgpt/web/hooks/usePagination';
|
||||
import QRCodePayModal, { type QRPayProps } from '@/components/support/wallet/QRCodePayModal';
|
||||
@@ -75,7 +75,7 @@ const BillTable = () => {
|
||||
refreshDeps: [billType]
|
||||
});
|
||||
|
||||
const { runAsync: handleRefreshPayOrder, loading: isRefreshing } = useRequest2(
|
||||
const { runAsync: handleRefreshPayOrder, loading: isRefreshing } = useRequest(
|
||||
async (bill: BillSchemaType) => {
|
||||
const { status, description } = await checkBalancePayResult(bill._id);
|
||||
if (status === BillStatusEnum.SUCCESS) {
|
||||
@@ -109,7 +109,7 @@ const BillTable = () => {
|
||||
}
|
||||
);
|
||||
|
||||
const { runAsync: handleCancelBill, loading: isCancelling } = useRequest2(
|
||||
const { runAsync: handleCancelBill, loading: isCancelling } = useRequest(
|
||||
async (billId: string) => {
|
||||
await cancelBill({ billId });
|
||||
},
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
} from '@chakra-ui/react';
|
||||
import { type TeamInvoiceHeaderType } from '@fastgpt/global/support/user/team/type';
|
||||
import MyBox from '@fastgpt/web/components/common/MyBox';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { type UseFormReturn, useForm } from 'react-hook-form';
|
||||
import FormLabel from '@fastgpt/web/components/common/MyBox/FormLabel';
|
||||
@@ -209,7 +209,7 @@ const InvoiceHeaderForm = () => {
|
||||
}
|
||||
});
|
||||
|
||||
const { loading: isLoading } = useRequest2(() => getTeamInvoiceHeader(), {
|
||||
const { loading: isLoading } = useRequest(() => getTeamInvoiceHeader(), {
|
||||
manual: false,
|
||||
onSuccess: (data) => {
|
||||
console.log(data, '--');
|
||||
@@ -219,7 +219,7 @@ const InvoiceHeaderForm = () => {
|
||||
|
||||
const { t } = useTranslation();
|
||||
|
||||
const { loading: isSubmitting, runAsync: onUpdateHeader } = useRequest2(
|
||||
const { loading: isSubmitting, runAsync: onUpdateHeader } = useRequest(
|
||||
(data: TeamInvoiceHeaderType) => updateTeamInvoiceHeader(data),
|
||||
{
|
||||
manual: true,
|
||||
|
||||
@@ -22,7 +22,7 @@ import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
import dayjs from 'dayjs';
|
||||
import { formatStorePrice2Read } from '@fastgpt/global/support/wallet/usage/tools';
|
||||
import MyModal from '@fastgpt/web/components/common/MyModal';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { downloadFetch } from '@/web/common/system/utils';
|
||||
|
||||
const InvoiceTable = () => {
|
||||
@@ -139,7 +139,7 @@ function InvoiceDetailModal({
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const { runAsync: handleDownloadInvoice } = useRequest2(async (id: string) => {
|
||||
const { runAsync: handleDownloadInvoice } = useRequest(async (id: string) => {
|
||||
await downloadFetch({
|
||||
url: `/api/proApi/support/wallet/bill/invoice/downloadFile?id=${id}`,
|
||||
filename: `${invoice.teamName}.pdf`
|
||||
|
||||
@@ -29,7 +29,7 @@ import type { ProviderEnum } from '@fastgpt/global/support/customDomain/type';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
import { generateCNAMEDomain } from '@fastgpt/global/support/customDomain/utils';
|
||||
import { useCopyData } from '@fastgpt/web/hooks/useCopyData';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import {
|
||||
activeCustomDomain,
|
||||
checkCustomDomainDNSResolve,
|
||||
@@ -117,7 +117,7 @@ function CreateCustomDomainModal<T extends 'create' | 'refresh'>({
|
||||
const [DnsResolved, setDnsResolved] = useState<boolean>(false);
|
||||
const [startDnsResolve, setStartDnsResolve] = useState<boolean>(type === 'create');
|
||||
|
||||
const { runAsync: checkDNSResolve } = useRequest2(
|
||||
const { runAsync: checkDNSResolve } = useRequest(
|
||||
() => checkCustomDomainDNSResolve({ cnameDomain, domain }),
|
||||
{
|
||||
manual: true,
|
||||
@@ -128,13 +128,13 @@ function CreateCustomDomainModal<T extends 'create' | 'refresh'>({
|
||||
}
|
||||
);
|
||||
|
||||
const { runAsync: activeDomain } = useRequest2(activeCustomDomain, {
|
||||
const { runAsync: activeDomain } = useRequest(activeCustomDomain, {
|
||||
manual: true,
|
||||
onSuccess: () => onClose(),
|
||||
successToast: t('common:Success')
|
||||
});
|
||||
|
||||
const { runAsync: createDomain, loading: loadingCreatingDomain } = useRequest2(
|
||||
const { runAsync: createDomain, loading: loadingCreatingDomain } = useRequest(
|
||||
createCustomDomain,
|
||||
{
|
||||
manual: true,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { ModalBody, Box, Input, Button, ModalFooter, Grid } from '@chakra-ui/react';
|
||||
import MyModal from '@fastgpt/web/components/common/MyModal';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { updateCustomDomainVerifyFile } from '@/web/support/customDomain/api';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import FormLabel from '@fastgpt/web/components/common/MyBox/FormLabel';
|
||||
@@ -18,7 +18,7 @@ function domainVerifyModal({ onClose, domain }: { onClose: () => void; domain: s
|
||||
const path = watch('path');
|
||||
const content = watch('content');
|
||||
|
||||
const { runAsync: updateVerifyFile, loading: isUpdating } = useRequest2(
|
||||
const { runAsync: updateVerifyFile, loading: isUpdating } = useRequest(
|
||||
updateCustomDomainVerifyFile,
|
||||
{
|
||||
manual: true,
|
||||
|
||||
@@ -4,7 +4,7 @@ import MyModal from '@fastgpt/web/components/common/MyModal';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import Icon from '@fastgpt/web/components/common/Icon';
|
||||
import Tag from '@fastgpt/web/components/common/Tag';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { balanceConversion } from '@/web/support/wallet/bill/api';
|
||||
import { useUserStore } from '@/web/support/user/useUserStore';
|
||||
import { formatStorePrice2Read } from '@fastgpt/global/support/wallet/usage/tools';
|
||||
@@ -29,7 +29,7 @@ const ConversionModal = ({
|
||||
return Math.ceil((balance / 15) * SUB_EXTRA_POINT_RATE);
|
||||
}, []);
|
||||
|
||||
const { runAsync: onConvert, loading } = useRequest2(balanceConversion, {
|
||||
const { runAsync: onConvert, loading } = useRequest(balanceConversion, {
|
||||
onSuccess() {
|
||||
router.reload();
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Box, Flex, Button, ModalBody } from '@chakra-ui/react';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { useUserStore } from '@/web/support/user/useUserStore';
|
||||
import dayjs from 'dayjs';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { getDiscountCouponList } from '@/web/support/wallet/sub/discountCoupon/api';
|
||||
import EmptyTip from '@fastgpt/web/components/common/EmptyTip';
|
||||
import { useRouter } from 'next/router';
|
||||
@@ -21,7 +21,7 @@ const DiscountCouponsModal = ({ onClose }: { onClose: () => void }) => {
|
||||
const [billId, setBillId] = useState<string>();
|
||||
const teamId = userInfo?.team?.teamId;
|
||||
|
||||
const { data: coupons = [], loading } = useRequest2(
|
||||
const { data: coupons = [], loading } = useRequest(
|
||||
async () => {
|
||||
if (!teamId) return [];
|
||||
return getDiscountCouponList(teamId);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { redeemCoupon } from '@/web/support/user/team/api';
|
||||
import { Button, Input, VStack, Text, ModalBody, Box, ModalFooter } from '@chakra-ui/react';
|
||||
import MyModal from '@fastgpt/web/components/common/MyModal';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import React from 'react';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
|
||||
@@ -16,7 +16,7 @@ const RedeemCouponModal = ({
|
||||
|
||||
const [couponCode, setCouponCode] = React.useState('');
|
||||
|
||||
const { runAsync: redeemCouponAsync, loading } = useRequest2(redeemCoupon, {
|
||||
const { runAsync: redeemCouponAsync, loading } = useRequest(redeemCoupon, {
|
||||
manual: true,
|
||||
onSuccess: () => {
|
||||
onSuccess();
|
||||
|
||||
@@ -3,7 +3,7 @@ import { ModalBody, Box, Flex, Input, ModalFooter, Button } from '@chakra-ui/rea
|
||||
import MyModal from '@fastgpt/web/components/common/MyModal';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { updatePasswordByOld } from '@/web/support/user/api';
|
||||
import { useToast } from '@fastgpt/web/hooks/useToast';
|
||||
import { checkPasswordRule } from '@fastgpt/global/common/string/password';
|
||||
@@ -26,7 +26,7 @@ const UpdatePswModal = ({ onClose }: { onClose: () => void }) => {
|
||||
}
|
||||
});
|
||||
|
||||
const { runAsync: onSubmit, loading: isLoading } = useRequest2(updatePasswordByOld, {
|
||||
const { runAsync: onSubmit, loading: isLoading } = useRequest(updatePasswordByOld, {
|
||||
onSuccess() {
|
||||
onClose();
|
||||
},
|
||||
|
||||
@@ -26,7 +26,7 @@ import {
|
||||
} from '@fastgpt/global/support/wallet/sub/constants';
|
||||
import { formatTime2YMDHM } from '@fastgpt/global/common/string/time';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
|
||||
type packageStatus = 'active' | 'inactive' | 'expired';
|
||||
|
||||
@@ -34,7 +34,7 @@ const StandDetailModal = ({ onClose }: { onClose: () => void }) => {
|
||||
const { t } = useTranslation();
|
||||
const { Loading } = useLoading();
|
||||
const { subPlans } = useSystemStore();
|
||||
const { data: teamPlans = [], loading: isLoading } = useRequest2(
|
||||
const { data: teamPlans = [], loading: isLoading } = useRequest(
|
||||
() =>
|
||||
getTeamPlans().then((res) => {
|
||||
return [
|
||||
|
||||
@@ -21,7 +21,7 @@ import React, { useMemo, useRef, useState } from 'react';
|
||||
import MySelect from '@fastgpt/web/components/common/MySelect';
|
||||
import { ModelTypeEnum } from '@fastgpt/global/core/ai/model';
|
||||
import Avatar from '@fastgpt/web/components/common/Avatar';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { getSystemModelDefaultConfig, putSystemModel } from '@/web/core/ai/config';
|
||||
import { type SystemModelItemType } from '@fastgpt/service/core/ai/type';
|
||||
import { useForm } from 'react-hook-form';
|
||||
@@ -126,7 +126,7 @@ export const ModelEditModal = ({
|
||||
return '';
|
||||
}, [isLLMModel, isEmbeddingModel, isTTSModel, t, isSTTModel, isRerankModel]);
|
||||
|
||||
const { runAsync: updateModel, loading: updatingModel } = useRequest2(
|
||||
const { runAsync: updateModel, loading: updatingModel } = useRequest(
|
||||
async (data: SystemModelItemType) => {
|
||||
for (const key in data) {
|
||||
// @ts-ignore
|
||||
@@ -151,7 +151,7 @@ export const ModelEditModal = ({
|
||||
);
|
||||
|
||||
const [key, setKey] = useState(0);
|
||||
const { runAsync: loadDefaultConfig, loading: loadingDefaultConfig } = useRequest2(
|
||||
const { runAsync: loadDefaultConfig, loading: loadingDefaultConfig } = useRequest(
|
||||
getSystemModelDefaultConfig,
|
||||
{
|
||||
onSuccess(res) {
|
||||
|
||||
@@ -28,7 +28,7 @@ import { type SystemModelItemType } from '@fastgpt/service/core/ai/type';
|
||||
import type { ModelTypeEnum } from '@fastgpt/global/core/ai/model';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
import { getSystemModelList } from '@/web/core/ai/config';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
import MyAvatar from '@fastgpt/web/components/common/Avatar';
|
||||
import MyTag from '@fastgpt/web/components/common/Tag/index';
|
||||
@@ -66,7 +66,7 @@ const EditChannelModal = ({
|
||||
});
|
||||
|
||||
const providerType = watch('type');
|
||||
const { data: providerList = [] } = useRequest2(
|
||||
const { data: providerList = [] } = useRequest(
|
||||
() =>
|
||||
getChannelProviders().then((res) => {
|
||||
return Object.entries(res)
|
||||
@@ -122,7 +122,7 @@ const EditChannelModal = ({
|
||||
data: systemModelList = [],
|
||||
runAsync: refreshSystemModelList,
|
||||
loading: loadingModels
|
||||
} = useRequest2(getSystemModelList, {
|
||||
} = useRequest(getSystemModelList, {
|
||||
manual: false
|
||||
});
|
||||
const modelList = useMemo(() => {
|
||||
@@ -150,7 +150,7 @@ const EditChannelModal = ({
|
||||
|
||||
const modelMapping = watch('model_mapping');
|
||||
|
||||
const { runAsync: onSubmit, loading: loadingCreate } = useRequest2(
|
||||
const { runAsync: onSubmit, loading: loadingCreate } = useRequest(
|
||||
(data: ChannelInfoType) => {
|
||||
if (data.models.length === 0) {
|
||||
return Promise.reject(t('account_model:selected_model_empty'));
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
ModalBody,
|
||||
ModalFooter
|
||||
} from '@chakra-ui/react';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import React, { useRef, useState } from 'react';
|
||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
@@ -69,7 +69,7 @@ const ModelTest = ({
|
||||
}
|
||||
});
|
||||
|
||||
const { loading: loadingModels } = useRequest2(getSystemModelList, {
|
||||
const { loading: loadingModels } = useRequest(getSystemModelList, {
|
||||
manual: false,
|
||||
refreshDeps: [models],
|
||||
onSuccess(res) {
|
||||
@@ -96,7 +96,7 @@ const ModelTest = ({
|
||||
}
|
||||
});
|
||||
|
||||
const { runAsync: onStartTest, loading: isAnyModelLoading } = useRequest2(
|
||||
const { runAsync: onStartTest, loading: isAnyModelLoading } = useRequest(
|
||||
async () => {
|
||||
let errorNum = 0;
|
||||
setTestModelList((prev) => prev.map((item) => ({ ...item, loading: true })));
|
||||
@@ -148,7 +148,7 @@ const ModelTest = ({
|
||||
}
|
||||
);
|
||||
|
||||
const { runAsync: onTestOneModel, loading: testingOneModel } = useRequest2(
|
||||
const { runAsync: onTestOneModel, loading: testingOneModel } = useRequest(
|
||||
async (model: string) => {
|
||||
const start = Date.now();
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
putChannel,
|
||||
putChannelStatus
|
||||
} from '@/web/core/ai/channel';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import React, { useState } from 'react';
|
||||
import {
|
||||
Table,
|
||||
@@ -52,23 +52,23 @@ const ChannelTable = ({ Tab }: { Tab: React.ReactNode }) => {
|
||||
data: channelList = [],
|
||||
runAsync: refreshChannelList,
|
||||
loading: loadingChannelList
|
||||
} = useRequest2(getChannelList, {
|
||||
} = useRequest(getChannelList, {
|
||||
manual: false
|
||||
});
|
||||
|
||||
const { data: channelProviders = {} } = useRequest2(getChannelProviders, {
|
||||
const { data: channelProviders = {} } = useRequest(getChannelProviders, {
|
||||
manual: false
|
||||
});
|
||||
|
||||
const [editChannel, setEditChannel] = useState<ChannelInfoType>();
|
||||
|
||||
const { runAsync: updateChannel, loading: loadingUpdateChannel } = useRequest2(putChannel, {
|
||||
const { runAsync: updateChannel, loading: loadingUpdateChannel } = useRequest(putChannel, {
|
||||
manual: true,
|
||||
onSuccess: () => {
|
||||
refreshChannelList();
|
||||
}
|
||||
});
|
||||
const { runAsync: updateChannelStatus, loading: loadingUpdateChannelStatus } = useRequest2(
|
||||
const { runAsync: updateChannelStatus, loading: loadingUpdateChannelStatus } = useRequest(
|
||||
putChannelStatus,
|
||||
{
|
||||
onSuccess: () => {
|
||||
@@ -80,7 +80,7 @@ const ChannelTable = ({ Tab }: { Tab: React.ReactNode }) => {
|
||||
const { openConfirm, ConfirmModal } = useConfirm({
|
||||
type: 'delete'
|
||||
});
|
||||
const { runAsync: onDeleteChannel, loading: loadingDeleteChannel } = useRequest2(deleteChannel, {
|
||||
const { runAsync: onDeleteChannel, loading: loadingDeleteChannel } = useRequest(deleteChannel, {
|
||||
manual: true,
|
||||
onSuccess: () => {
|
||||
refreshChannelList();
|
||||
|
||||
@@ -24,7 +24,7 @@ import DateRangePicker, {
|
||||
import MyBox from '@fastgpt/web/components/common/MyBox';
|
||||
import FormLabel from '@fastgpt/web/components/common/MyBox/FormLabel';
|
||||
import MySelect from '@fastgpt/web/components/common/MySelect';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useScrollPagination } from '@fastgpt/web/hooks/useScrollPagination';
|
||||
import { addDays } from 'date-fns';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
@@ -77,7 +77,7 @@ const ChannelLog = ({ Tab }: { Tab: React.ReactNode }) => {
|
||||
}
|
||||
});
|
||||
|
||||
const { data: channelList = [] } = useRequest2(
|
||||
const { data: channelList = [] } = useRequest(
|
||||
async () => {
|
||||
const res = await getChannelList().then((res) =>
|
||||
res.map((item) => ({
|
||||
@@ -98,7 +98,7 @@ const ChannelLog = ({ Tab }: { Tab: React.ReactNode }) => {
|
||||
}
|
||||
);
|
||||
|
||||
const { data: systemModelList = [] } = useRequest2(getSystemModelList, {
|
||||
const { data: systemModelList = [] } = useRequest(getSystemModelList, {
|
||||
manual: false
|
||||
});
|
||||
const modelList = useMemo(() => {
|
||||
@@ -288,7 +288,7 @@ export default ChannelLog;
|
||||
|
||||
const LogDetail = ({ data, onClose }: { data: LogDetailType; onClose: () => void }) => {
|
||||
const { t } = useTranslation();
|
||||
const { data: detailData } = useRequest2(
|
||||
const { data: detailData } = useRequest(
|
||||
async () => {
|
||||
if (data.code === 200) return data;
|
||||
try {
|
||||
|
||||
@@ -24,7 +24,7 @@ import SearchInput from '@fastgpt/web/components/common/Input/SearchInput';
|
||||
import Avatar from '@fastgpt/web/components/common/Avatar';
|
||||
import MyTag from '@fastgpt/web/components/common/Tag/index';
|
||||
import dynamic from 'next/dynamic';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import {
|
||||
deleteSystemModel,
|
||||
getModelConfigJson,
|
||||
@@ -87,7 +87,7 @@ const ModelTable = ({ Tab }: { Tab: React.ReactNode }) => {
|
||||
data: systemModelList = [],
|
||||
runAsync: refreshSystemModelList,
|
||||
loading: loadingModels
|
||||
} = useRequest2(getSystemModelList, {
|
||||
} = useRequest(getSystemModelList, {
|
||||
manual: false
|
||||
});
|
||||
const refreshModels = useCallback(async () => {
|
||||
@@ -256,20 +256,20 @@ const ModelTable = ({ Tab }: { Tab: React.ReactNode }) => {
|
||||
);
|
||||
}, [systemModelList]);
|
||||
|
||||
const { runAsync: onTestModel, loading: testingModel } = useRequest2(getTestModel, {
|
||||
const { runAsync: onTestModel, loading: testingModel } = useRequest(getTestModel, {
|
||||
manual: true,
|
||||
successToast: t('common:Success')
|
||||
});
|
||||
const { runAsync: updateModel, loading: updatingModel } = useRequest2(putSystemModel, {
|
||||
const { runAsync: updateModel, loading: updatingModel } = useRequest(putSystemModel, {
|
||||
onSuccess: refreshModels
|
||||
});
|
||||
|
||||
const { runAsync: deleteModel } = useRequest2(deleteSystemModel, {
|
||||
const { runAsync: deleteModel } = useRequest(deleteSystemModel, {
|
||||
onSuccess: refreshModels
|
||||
});
|
||||
|
||||
const [editModelData, setEditModelData] = useState<SystemModelItemType>();
|
||||
const { runAsync: onEditModel, loading: loadingData } = useRequest2(
|
||||
const { runAsync: onEditModel, loading: loadingData } = useRequest(
|
||||
(modelId: string) => getSystemModelDetail(modelId),
|
||||
{
|
||||
onSuccess: (data: SystemModelItemType) => {
|
||||
@@ -507,14 +507,14 @@ const JsonConfigModal = ({
|
||||
const { t } = useTranslation();
|
||||
|
||||
const [data, setData] = useState<string>('');
|
||||
const { loading } = useRequest2(getModelConfigJson, {
|
||||
const { loading } = useRequest(getModelConfigJson, {
|
||||
manual: false,
|
||||
onSuccess(res) {
|
||||
setData(res);
|
||||
}
|
||||
});
|
||||
|
||||
const { runAsync } = useRequest2(putUpdateWithJson, {
|
||||
const { runAsync } = useRequest(putUpdateWithJson, {
|
||||
onSuccess: () => {
|
||||
onSuccess();
|
||||
onClose();
|
||||
@@ -583,7 +583,7 @@ const DefaultModelModal = ({
|
||||
// Create a copy of defaultModels for local state management
|
||||
const [defaultData, setDefaultData] = useState(defaultModels);
|
||||
|
||||
const { runAsync, loading } = useRequest2(putUpdateDefaultModels, {
|
||||
const { runAsync, loading } = useRequest(putUpdateDefaultModels, {
|
||||
onSuccess: () => {
|
||||
onSuccess();
|
||||
onClose();
|
||||
|
||||
@@ -2,7 +2,7 @@ import React, { useMemo, useState } from 'react';
|
||||
import type { BoxProps } from '@chakra-ui/react';
|
||||
import { Box, Grid, HStack, useTheme } from '@chakra-ui/react';
|
||||
import MyBox from '@fastgpt/web/components/common/MyBox';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { addHours } from 'date-fns';
|
||||
import dayjs from 'dayjs';
|
||||
@@ -84,7 +84,7 @@ const ModelDashboard = ({ Tab }: { Tab: React.ReactNode }) => {
|
||||
});
|
||||
|
||||
// Fetch channel list with "All" option
|
||||
const { data: channelList = [] } = useRequest2(
|
||||
const { data: channelList = [] } = useRequest(
|
||||
async () => {
|
||||
const res = await getChannelList().then((res) =>
|
||||
res.map((item) => ({
|
||||
@@ -106,7 +106,7 @@ const ModelDashboard = ({ Tab }: { Tab: React.ReactNode }) => {
|
||||
);
|
||||
|
||||
// Get model list filtered by selected channel
|
||||
const { data: systemModelList = [] } = useRequest2(getSystemModelList, {
|
||||
const { data: systemModelList = [] } = useRequest(getSystemModelList, {
|
||||
manual: false
|
||||
});
|
||||
const modelList = useMemo(() => {
|
||||
@@ -193,7 +193,7 @@ const ModelDashboard = ({ Tab }: { Tab: React.ReactNode }) => {
|
||||
};
|
||||
|
||||
// Fetch dashboard data with date range and channel filters
|
||||
const { data: dashboardData = [], loading: isLoading } = useRequest2(
|
||||
const { data: dashboardData = [], loading: isLoading } = useRequest(
|
||||
async () => {
|
||||
const params = {
|
||||
channel: filterProps.channelId ? parseInt(filterProps.channelId) : undefined,
|
||||
|
||||
@@ -51,32 +51,37 @@ function EditModal({
|
||||
const avatar = watch('avatar');
|
||||
const notificationAccount = watch('notificationAccount');
|
||||
|
||||
const { mutate: onclickCreate, isLoading: creating } = useRequest({
|
||||
mutationFn: async (data: CreateTeamProps) => {
|
||||
const { runAsync: onclickCreate, loading: creating } = useRequest(
|
||||
async (data: CreateTeamProps) => {
|
||||
return postCreateTeam(data);
|
||||
},
|
||||
onSuccess() {
|
||||
onSuccess();
|
||||
onClose();
|
||||
},
|
||||
successToast: t('common:create_success'),
|
||||
errorToast: t('common:create_failed')
|
||||
});
|
||||
const { mutate: onclickUpdate, isLoading: updating } = useRequest({
|
||||
mutationFn: async (data: EditTeamFormDataType) => {
|
||||
{
|
||||
onSuccess() {
|
||||
onSuccess();
|
||||
onClose();
|
||||
},
|
||||
successToast: t('common:create_success'),
|
||||
errorToast: t('common:create_failed')
|
||||
}
|
||||
);
|
||||
|
||||
const { runAsync: onclickUpdate, loading: updating } = useRequest(
|
||||
async (data: EditTeamFormDataType) => {
|
||||
if (!data.id) return Promise.resolve('');
|
||||
return putUpdateTeam({
|
||||
name: data.name,
|
||||
avatar: data.avatar
|
||||
});
|
||||
},
|
||||
onSuccess() {
|
||||
onSuccess();
|
||||
onClose();
|
||||
},
|
||||
successToast: t('common:update_success'),
|
||||
errorToast: t('common:update_failed')
|
||||
});
|
||||
{
|
||||
onSuccess() {
|
||||
onSuccess();
|
||||
onClose();
|
||||
},
|
||||
successToast: t('common:update_success'),
|
||||
errorToast: t('common:update_failed')
|
||||
}
|
||||
);
|
||||
|
||||
const { isOpen: isOpenContact, onClose: onCloseContact, onOpen: onOpenContact } = useDisclosure();
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import Avatar from '@fastgpt/web/components/common/Avatar';
|
||||
import FormLabel from '@fastgpt/web/components/common/MyBox/FormLabel';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import React from 'react';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { postCreateGroup, putUpdateGroup } from '@/web/support/user/team/group/api';
|
||||
import { DEFAULT_TEAM_AVATAR } from '@fastgpt/global/common/system/constants';
|
||||
@@ -45,7 +45,7 @@ function GroupInfoModal({
|
||||
}
|
||||
});
|
||||
|
||||
const { runAsync: onCreate, loading: isLoadingCreate } = useRequest2(
|
||||
const { runAsync: onCreate, loading: isLoadingCreate } = useRequest(
|
||||
(data: GroupFormType) => {
|
||||
return postCreateGroup({
|
||||
name: data.name,
|
||||
@@ -57,7 +57,7 @@ function GroupInfoModal({
|
||||
}
|
||||
);
|
||||
|
||||
const { runAsync: onUpdate, loading: isLoadingUpdate } = useRequest2(
|
||||
const { runAsync: onUpdate, loading: isLoadingUpdate } = useRequest(
|
||||
async (data: GroupFormType) => {
|
||||
if (!editGroup) return;
|
||||
return putUpdateGroup({
|
||||
|
||||
@@ -6,7 +6,7 @@ import Tag from '@fastgpt/web/components/common/Tag';
|
||||
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import React, { useEffect, useMemo, useState } from 'react';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { putUpdateGroup } from '@/web/support/user/team/group/api';
|
||||
import type { GroupMemberRole } from '@fastgpt/global/support/permission/memberGroup/constant';
|
||||
import { useUserStore } from '@/web/support/user/useUserStore';
|
||||
@@ -96,7 +96,7 @@ function GroupEditModal({
|
||||
|
||||
const [hoveredMemberId, setHoveredMemberId] = useState<string>();
|
||||
|
||||
const { runAsync: onUpdate, loading: isLoadingUpdate } = useRequest2(
|
||||
const { runAsync: onUpdate, loading: isLoadingUpdate } = useRequest(
|
||||
async () => {
|
||||
if (!group._id || !groupMembers.length) return;
|
||||
|
||||
|
||||
+2
-2
@@ -13,7 +13,7 @@ import {
|
||||
import { type TeamMemberItemType } from '@fastgpt/global/support/user/team/type';
|
||||
import Avatar from '@fastgpt/web/components/common/Avatar';
|
||||
import MyModal from '@fastgpt/web/components/common/MyModal';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { TeamContext } from '../context';
|
||||
@@ -69,7 +69,7 @@ export function ChangeOwnerModal({
|
||||
|
||||
const [keepAdmin, setKeepAdmin] = useState(true);
|
||||
|
||||
const { runAsync: onTransfer, loading } = useRequest2(
|
||||
const { runAsync: onTransfer, loading } = useRequest(
|
||||
(tmbId: string) => putGroupChangeOwner(group._id, tmbId),
|
||||
{
|
||||
onSuccess: () => Promise.all([onClose(), onSuccess()]),
|
||||
|
||||
@@ -18,7 +18,7 @@ import MyBox from '@fastgpt/web/components/common/MyBox';
|
||||
import MyMenu, { type MenuItemType } from '@fastgpt/web/components/common/MyMenu';
|
||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
import { useUserStore } from '@/web/support/user/useUserStore';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { deleteGroup, getGroupList } from '@/web/support/user/team/group/api';
|
||||
import { DefaultGroupName } from '@fastgpt/global/support/user/team/group/constant';
|
||||
import MemberTag from '../../../../components/support/user/team/Info/MemberTag';
|
||||
@@ -40,7 +40,7 @@ function MemberTable({ Tabs }: { Tabs: React.ReactNode }) {
|
||||
data: groups = [],
|
||||
loading: isLoadingGroups,
|
||||
refresh: refetchGroups
|
||||
} = useRequest2(() => getGroupList<true>({ withMembers: true }), {
|
||||
} = useRequest(() => getGroupList<true>({ withMembers: true }), {
|
||||
manual: false,
|
||||
refreshDeps: [userInfo?.team?.teamId]
|
||||
});
|
||||
@@ -61,7 +61,7 @@ function MemberTable({ Tabs }: { Tabs: React.ReactNode }) {
|
||||
type: 'delete',
|
||||
content: t('account_team:confirm_delete_group')
|
||||
});
|
||||
const { runAsync: delDeleteGroup } = useRequest2(deleteGroup, {
|
||||
const { runAsync: delDeleteGroup } = useRequest(deleteGroup, {
|
||||
onSuccess: () => {
|
||||
refetchGroups();
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ import {
|
||||
import FormLabel from '@fastgpt/web/components/common/MyBox/FormLabel';
|
||||
import MyModal from '@fastgpt/web/components/common/MyModal';
|
||||
import MySelect from '@fastgpt/web/components/common/MySelect';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { useForm } from 'react-hook-form';
|
||||
|
||||
@@ -47,7 +47,7 @@ function CreateInvitationModal({
|
||||
const expires = watch('expires');
|
||||
const usedTimesLimit = watch('usedTimesLimit');
|
||||
|
||||
const { runAsync: createInvitationLink, loading } = useRequest2(postCreateInvitationLink, {
|
||||
const { runAsync: createInvitationLink, loading } = useRequest(postCreateInvitationLink, {
|
||||
manual: true,
|
||||
errorToast: t('common:create_failed'),
|
||||
onSuccess: (data) => {
|
||||
|
||||
@@ -2,7 +2,7 @@ import { getInvitationInfo, postAcceptInvitationLink } from '@/web/support/user/
|
||||
import { Box, Button, Flex, ModalBody, ModalCloseButton } from '@chakra-ui/react';
|
||||
import Avatar from '@fastgpt/web/components/common/Avatar';
|
||||
import MyModal from '@fastgpt/web/components/common/MyModal';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { useRouter } from 'next/router';
|
||||
import { useContextSelector } from 'use-context-selector';
|
||||
@@ -18,12 +18,12 @@ function Invite({ invitelinkid }: { invitelinkid: string }) {
|
||||
router.push('/account/team');
|
||||
};
|
||||
|
||||
const { data: invitationInfo } = useRequest2(() => getInvitationInfo(invitelinkid), {
|
||||
const { data: invitationInfo } = useRequest(() => getInvitationInfo(invitelinkid), {
|
||||
manual: false,
|
||||
onError: onClose
|
||||
});
|
||||
|
||||
const { runAsync: acceptInvitation, loading: accepting } = useRequest2(
|
||||
const { runAsync: acceptInvitation, loading: accepting } = useRequest(
|
||||
() => postAcceptInvitationLink(invitelinkid),
|
||||
{
|
||||
manual: true,
|
||||
|
||||
@@ -27,7 +27,7 @@ import MyModal from '@fastgpt/web/components/common/MyModal';
|
||||
import MyPopover from '@fastgpt/web/components/common/MyPopover';
|
||||
import Tag from '@fastgpt/web/components/common/Tag';
|
||||
import { useCopyData } from '@fastgpt/web/hooks/useCopyData';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import format from 'date-fns/format';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import dynamic from 'next/dynamic';
|
||||
@@ -42,7 +42,7 @@ const InviteModal = ({ onClose }: { onClose: () => void }) => {
|
||||
data: invitationLinkList,
|
||||
loading: isLoadingLink,
|
||||
runAsync: refetchInvitationLinkList
|
||||
} = useRequest2(() => getInvitationLinkList(), {
|
||||
} = useRequest(() => getInvitationLinkList(), {
|
||||
manual: false
|
||||
});
|
||||
|
||||
@@ -71,7 +71,7 @@ const InviteModal = ({ onClose }: { onClose: () => void }) => {
|
||||
[copyData, feConfigs?.systemTitle, t, userInfo?.team.memberName, userInfo?.team.teamName]
|
||||
);
|
||||
|
||||
const { runAsync: onForbid, loading: forbiding } = useRequest2(putForbidInvitationLink, {
|
||||
const { runAsync: onForbid, loading: forbiding } = useRequest(putForbidInvitationLink, {
|
||||
manual: true,
|
||||
onSuccess: refetchInvitationLinkList,
|
||||
successToast: t('account_team:forbid_success')
|
||||
|
||||
@@ -28,7 +28,7 @@ import { TeamContext } from './context';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
import dynamic from 'next/dynamic';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { delLeaveTeam } from '@/web/support/user/team/api';
|
||||
import { GetSearchUserGroupOrg, postSyncMembers } from '@/web/support/user/api';
|
||||
import {
|
||||
@@ -123,13 +123,13 @@ function MemberTable({ Tabs }: { Tabs: React.ReactNode }) {
|
||||
|
||||
const { isOpen: isOpenInvite, onOpen: onOpenInvite, onClose: onCloseInvite } = useDisclosure();
|
||||
|
||||
const { runAsync: onSyncMember, loading: isSyncing } = useRequest2(postSyncMembers, {
|
||||
const { runAsync: onSyncMember, loading: isSyncing } = useRequest(postSyncMembers, {
|
||||
onSuccess: onRefreshMembers,
|
||||
successToast: t('account_team:sync_member_success'),
|
||||
errorToast: t('account_team:sync_member_failed')
|
||||
});
|
||||
|
||||
const { runAsync: onLeaveTeam } = useRequest2(delLeaveTeam, {
|
||||
const { runAsync: onLeaveTeam } = useRequest(delLeaveTeam, {
|
||||
onSuccess() {
|
||||
const defaultTeam = myTeams[0];
|
||||
onSwitchTeam(defaultTeam.teamId);
|
||||
@@ -137,11 +137,11 @@ function MemberTable({ Tabs }: { Tabs: React.ReactNode }) {
|
||||
errorToast: t('account_team:user_team_leave_team_failed')
|
||||
});
|
||||
|
||||
const { runAsync: onRemoveMember } = useRequest2(delRemoveMember, {
|
||||
const { runAsync: onRemoveMember } = useRequest(delRemoveMember, {
|
||||
onSuccess: onRefreshMembers
|
||||
});
|
||||
|
||||
const { runAsync: onRestore } = useRequest2(postRestoreMember, {
|
||||
const { runAsync: onRestore } = useRequest(postRestoreMember, {
|
||||
onSuccess: onRefreshMembers,
|
||||
successToast: t('common:Success'),
|
||||
errorToast: t('common:user.team.invite.Reject')
|
||||
|
||||
@@ -6,7 +6,7 @@ import { useUploadAvatar } from '@fastgpt/web/common/file/hooks/useUploadAvatar'
|
||||
import Avatar from '@fastgpt/web/components/common/Avatar';
|
||||
import FormLabel from '@fastgpt/web/components/common/MyBox/FormLabel';
|
||||
import MyModal from '@fastgpt/web/components/common/MyModal';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { useForm } from 'react-hook-form';
|
||||
|
||||
@@ -52,7 +52,7 @@ function OrgInfoModal({
|
||||
});
|
||||
const avatar = watch('avatar');
|
||||
|
||||
const { run: onCreate, loading: isLoadingCreate } = useRequest2(
|
||||
const { run: onCreate, loading: isLoadingCreate } = useRequest(
|
||||
async (data: OrgFormType) => {
|
||||
if (parentId === undefined) return;
|
||||
return postCreateOrg({
|
||||
@@ -71,7 +71,7 @@ function OrgInfoModal({
|
||||
}
|
||||
);
|
||||
|
||||
const { runAsync: onUpdate, loading: isLoadingUpdate } = useRequest2(
|
||||
const { runAsync: onUpdate, loading: isLoadingUpdate } = useRequest(
|
||||
async (data: OrgFormType) => {
|
||||
if (!editOrg._id) return;
|
||||
return putUpdateOrg({
|
||||
|
||||
@@ -5,7 +5,7 @@ import Avatar from '@fastgpt/web/components/common/Avatar';
|
||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
import SearchInput from '@fastgpt/web/components/common/Input/SearchInput';
|
||||
import MyModal from '@fastgpt/web/components/common/MyModal';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { type OrgListItemType } from '@fastgpt/global/support/user/team/org/type';
|
||||
@@ -69,7 +69,7 @@ function OrgMemberManageModal({
|
||||
);
|
||||
}, [orgMembers]);
|
||||
|
||||
const { run: onUpdate, loading: isLoadingUpdate } = useRequest2(
|
||||
const { run: onUpdate, loading: isLoadingUpdate } = useRequest(
|
||||
() => {
|
||||
return putUpdateOrgMembers({
|
||||
orgId: currentOrg._id,
|
||||
|
||||
@@ -2,7 +2,7 @@ import { getOrgList, putMoveOrg } from '@/web/support/user/team/org/api';
|
||||
import { Button, ModalBody, ModalFooter } from '@chakra-ui/react';
|
||||
import type { OrgListItemType, OrgType } from '@fastgpt/global/support/user/team/org/type';
|
||||
import MyModal from '@fastgpt/web/components/common/MyModal';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { useMemo, useState } from 'react';
|
||||
import OrgTree from './OrgTree';
|
||||
@@ -21,7 +21,7 @@ function OrgMoveModal({
|
||||
const { t } = useTranslation();
|
||||
const [selectedOrg, setSelectedOrg] = useState<OrgListItemType>();
|
||||
|
||||
const { runAsync: onMoveOrg, loading } = useRequest2(putMoveOrg, {
|
||||
const { runAsync: onMoveOrg, loading } = useRequest(putMoveOrg, {
|
||||
onSuccess: () => {
|
||||
onClose();
|
||||
onSuccess();
|
||||
|
||||
@@ -5,7 +5,7 @@ import { useToggle } from 'ahooks';
|
||||
import { useState } from 'react';
|
||||
import IconButton from './IconButton';
|
||||
import { useUserStore } from '@/web/support/user/useUserStore';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { getOrgList } from '@/web/support/user/team/org/api';
|
||||
import { getChildrenByOrg } from '@fastgpt/service/support/permission/org/controllers';
|
||||
import { getOrgChildrenPath } from '@fastgpt/global/support/user/team/org/constant';
|
||||
@@ -25,7 +25,7 @@ function OrgTreeNode({
|
||||
}) {
|
||||
const [isExpanded, toggleIsExpanded] = useToggle(index === 0);
|
||||
const [canBeExpanded, setCanBeExpanded] = useState(true);
|
||||
const { data: orgs = [], runAsync: getOrgs } = useRequest2(() =>
|
||||
const { data: orgs = [], runAsync: getOrgs } = useRequest(() =>
|
||||
getOrgList({ orgId: org._id, withPermission: false })
|
||||
);
|
||||
const onClickExpand = async () => {
|
||||
|
||||
@@ -20,7 +20,7 @@ import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
import type { IconNameType } from '@fastgpt/web/components/common/Icon/type';
|
||||
import MyMenu from '@fastgpt/web/components/common/MyMenu';
|
||||
import { useConfirm } from '@fastgpt/web/hooks/useConfirm';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { useMemo, useState } from 'react';
|
||||
import MemberTag from '@/components/support/user/team/Info/MemberTag';
|
||||
@@ -100,7 +100,7 @@ function OrgTable({ Tabs }: { Tabs: React.ReactNode }) {
|
||||
});
|
||||
const deleteOrgHandler = (orgId: string) =>
|
||||
openDeleteOrgModal({ onConfirm: () => deleteOrgReq(orgId) })();
|
||||
const { runAsync: deleteOrgReq } = useRequest2(deleteOrg, {
|
||||
const { runAsync: deleteOrgReq } = useRequest(deleteOrg, {
|
||||
onSuccess: refresh
|
||||
});
|
||||
|
||||
@@ -115,11 +115,11 @@ function OrgTable({ Tabs }: { Tabs: React.ReactNode }) {
|
||||
type: 'delete'
|
||||
});
|
||||
|
||||
const { runAsync: deleteMemberReq } = useRequest2(deleteOrgMember, {
|
||||
const { runAsync: deleteMemberReq } = useRequest(deleteOrgMember, {
|
||||
onSuccess: refresh
|
||||
});
|
||||
|
||||
const { runAsync: deleteMemberFromTeamReq } = useRequest2(delRemoveMember, {
|
||||
const { runAsync: deleteMemberFromTeamReq } = useRequest(delRemoveMember, {
|
||||
onSuccess: refresh
|
||||
});
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
Button
|
||||
} from '@chakra-ui/react';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import {
|
||||
deleteMemberPermission,
|
||||
getTeamClbs,
|
||||
@@ -83,7 +83,7 @@ function PermissionManage({
|
||||
|
||||
const [searchKey, setSearchKey] = useState('');
|
||||
|
||||
const { data: searchResult } = useRequest2(() => GetSearchUserGroupOrg(searchKey), {
|
||||
const { data: searchResult } = useRequest(() => GetSearchUserGroupOrg(searchKey), {
|
||||
manual: false,
|
||||
throttleWait: 500,
|
||||
debounceWait: 200,
|
||||
@@ -114,7 +114,7 @@ function PermissionManage({
|
||||
};
|
||||
}, [collaboratorList, searchResult, searchKey]);
|
||||
|
||||
const { runAsync: onUpdatePermission, loading: addLoading } = useRequest2(
|
||||
const { runAsync: onUpdatePermission, loading: addLoading } = useRequest(
|
||||
async ({ id, type, per }: { id: string; type: 'add' | 'remove'; per: PermissionValueType }) => {
|
||||
const clb = collaboratorList.find(
|
||||
(clb) => clb.tmbId === id || clb.groupId === id || clb.orgId === id
|
||||
@@ -141,7 +141,7 @@ function PermissionManage({
|
||||
}
|
||||
);
|
||||
|
||||
const { runAsync: onDeleteMemberPermission, loading: deleteLoading } = useRequest2(
|
||||
const { runAsync: onDeleteMemberPermission, loading: deleteLoading } = useRequest(
|
||||
async (props) => {
|
||||
if (onDelOneCollaborator) {
|
||||
return await onDelOneCollaborator(props);
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
import { TeamMemberStatusEnum } from '@fastgpt/global/support/user/team/constant';
|
||||
import { useUserStore } from '@/web/support/user/useUserStore';
|
||||
import type { TeamTmbItemType, TeamMemberItemType } from '@fastgpt/global/support/user/team/type';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { useRouter } from 'next/router';
|
||||
|
||||
@@ -57,17 +57,17 @@ export const TeamModalContextProvider = ({ children }: { children: ReactNode })
|
||||
data: myTeams = [],
|
||||
loading: isLoadingTeams,
|
||||
refresh: refetchTeams
|
||||
} = useRequest2(() => getTeamList(TeamMemberStatusEnum.active), {
|
||||
} = useRequest(() => getTeamList(TeamMemberStatusEnum.active), {
|
||||
manual: false,
|
||||
refreshDeps: [userInfo?._id]
|
||||
});
|
||||
|
||||
const { data: teamMemberCountData, refresh: refetchTeamSize } = useRequest2(getTeamMemberCount, {
|
||||
const { data: teamMemberCountData, refresh: refetchTeamSize } = useRequest(getTeamMemberCount, {
|
||||
manual: false,
|
||||
refreshDeps: [userInfo?.team?.teamId]
|
||||
});
|
||||
|
||||
const { runAsync: onSwitchTeam, loading: isSwitchingTeam } = useRequest2(
|
||||
const { runAsync: onSwitchTeam, loading: isSwitchingTeam } = useRequest(
|
||||
async (teamId: string) => {
|
||||
await putSwitchTeam(teamId);
|
||||
return initUserInfo();
|
||||
|
||||
@@ -3,7 +3,7 @@ import { ModalBody, Box, Flex, Input, ModalFooter, Button } from '@chakra-ui/rea
|
||||
import MyModal from '@fastgpt/web/components/common/MyModal';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import type { OpenaiAccountType } from '@fastgpt/global/support/user/team/type';
|
||||
import { useUserStore } from '@/web/support/user/useUserStore';
|
||||
import { putUpdateTeam } from '@/web/support/user/team/api';
|
||||
@@ -21,7 +21,7 @@ const OpenAIAccountModal = ({
|
||||
defaultValues: defaultData
|
||||
});
|
||||
|
||||
const { runAsync: onSubmit, loading } = useRequest2(
|
||||
const { runAsync: onSubmit, loading } = useRequest(
|
||||
async (data: OpenaiAccountType) => {
|
||||
if (!userInfo?.team.teamId) return;
|
||||
return putUpdateTeam({
|
||||
|
||||
+2
-2
@@ -6,7 +6,7 @@ import { useTranslation } from 'next-i18next';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { useUserStore } from '@/web/support/user/useUserStore';
|
||||
import { putUpdateTeam } from '@/web/support/user/team/api';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
|
||||
const WorkflowVariableModal = ({
|
||||
defaultData,
|
||||
@@ -25,7 +25,7 @@ const WorkflowVariableModal = ({
|
||||
}
|
||||
});
|
||||
|
||||
const { runAsync: onSubmit, loading } = useRequest2(
|
||||
const { runAsync: onSubmit, loading } = useRequest(
|
||||
async (data: { key: string; value: string }) => {
|
||||
if (!userInfo?.team.teamId) return;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { getDashboardData } from '@/web/support/wallet/usage/api';
|
||||
import { Box, Button, Flex, useDisclosure } from '@chakra-ui/react';
|
||||
import MyBox from '@fastgpt/web/components/common/MyBox';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { addDays } from 'date-fns';
|
||||
import React, { useMemo } from 'react';
|
||||
import { type UsageFilterParams } from './type';
|
||||
@@ -27,7 +27,7 @@ const UsageDashboard = ({
|
||||
const { dateRange, selectTmbIds, usageSources, unit, isSelectAllSource, isSelectAllTmb } =
|
||||
filterParams;
|
||||
|
||||
const { data: totalPoints = [], loading: totalPointsLoading } = useRequest2(
|
||||
const { data: totalPoints = [], loading: totalPointsLoading } = useRequest(
|
||||
() =>
|
||||
getDashboardData({
|
||||
dateStart: dateRange.from
|
||||
|
||||
@@ -25,7 +25,7 @@ import { addDays } from 'date-fns';
|
||||
import dynamic from 'next/dynamic';
|
||||
import { type UsageFilterParams } from './type';
|
||||
import PopoverConfirm from '@fastgpt/web/components/common/MyPopover/PopoverConfirm';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { downloadFetch } from '@/web/common/system/utils';
|
||||
import { useSafeTranslation } from '@fastgpt/web/hooks/useSafeTranslation';
|
||||
|
||||
@@ -83,7 +83,7 @@ const UsageTableList = ({
|
||||
|
||||
const [usageDetail, setUsageDetail] = useState<UsageListItemType>();
|
||||
|
||||
const { runAsync: exportUsage } = useRequest2(
|
||||
const { runAsync: exportUsage } = useRequest(
|
||||
async () => {
|
||||
await downloadFetch({
|
||||
url: `/api/proApi/support/wallet/usage/exportUsage`,
|
||||
|
||||
@@ -9,7 +9,7 @@ import { cardStyles } from '../constants';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { type HttpToolConfigType } from '@fastgpt/global/core/app/type';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import Markdown from '@/components/Markdown';
|
||||
import { postRunHTTPTool } from '@/web/core/app/api/tool';
|
||||
import { type StoreSecretValueType } from '@fastgpt/global/common/secret/type';
|
||||
@@ -50,7 +50,7 @@ const ChatTest = ({
|
||||
setOutput('');
|
||||
}, [currentTool, reset]);
|
||||
|
||||
const { runAsync: runTool, loading: isRunning } = useRequest2(
|
||||
const { runAsync: runTool, loading: isRunning } = useRequest(
|
||||
async (data: Record<string, any>) => {
|
||||
if (!currentTool) return;
|
||||
return postRunHTTPTool({
|
||||
|
||||
@@ -12,7 +12,7 @@ import React, { useState } from 'react';
|
||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
import FormLabel from '@fastgpt/web/components/common/MyBox/FormLabel';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { AppContext } from '../context';
|
||||
import { useContextSelector } from 'use-context-selector';
|
||||
import MyIconButton from '@fastgpt/web/components/common/Icon/button';
|
||||
@@ -60,7 +60,7 @@ const EditForm = ({
|
||||
onClose: onCloseConfigModal
|
||||
} = useDisclosure();
|
||||
|
||||
const { runAsync: runDeleteHttpTool, loading: isDeletingTool } = useRequest2(
|
||||
const { runAsync: runDeleteHttpTool, loading: isDeletingTool } = useRequest(
|
||||
async (updatedToolList: HttpToolConfigType[]) =>
|
||||
await putUpdateHttpPlugin({
|
||||
appId: appDetail._id,
|
||||
@@ -327,7 +327,7 @@ const ToolDetailModal = ({
|
||||
return initial;
|
||||
});
|
||||
|
||||
const { runAsync: runUpdateHttpPlugin, loading: isUpdating } = useRequest2(
|
||||
const { runAsync: runUpdateHttpPlugin, loading: isUpdating } = useRequest(
|
||||
async (data: UpdateHttpPluginBody) => await putUpdateHttpPlugin(data),
|
||||
{
|
||||
manual: true,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Box, Flex } from '@chakra-ui/react';
|
||||
import FolderPath from '@/components/common/folder/Path';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useContextSelector } from 'use-context-selector';
|
||||
import { AppContext } from '../context';
|
||||
import { getAppFolderPath } from '@/web/core/app/api/app';
|
||||
@@ -16,7 +16,7 @@ const Header = () => {
|
||||
|
||||
const { lastAppListRouteType } = useSystemStore();
|
||||
|
||||
const { data: paths = [] } = useRequest2(
|
||||
const { data: paths = [] } = useRequest(
|
||||
() => getAppFolderPath({ sourceId: appId, type: 'parent' }),
|
||||
{
|
||||
manual: false,
|
||||
|
||||
@@ -25,7 +25,7 @@ import {
|
||||
AccordionIcon
|
||||
} from '@chakra-ui/react';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useContextSelector } from 'use-context-selector';
|
||||
import { AppContext } from '../context';
|
||||
import FormLabel from '@fastgpt/web/components/common/MyBox/FormLabel';
|
||||
@@ -148,7 +148,7 @@ const ManualToolModal = ({
|
||||
onClose: onCloseCurlImport
|
||||
} = useDisclosure();
|
||||
|
||||
const { runAsync: onSubmit, loading: isSubmitting } = useRequest2(
|
||||
const { runAsync: onSubmit, loading: isSubmitting } = useRequest(
|
||||
async (data: ManualToolFormType) => {
|
||||
if (bodyType === ContentTypes.json && bodyContent) {
|
||||
try {
|
||||
|
||||
@@ -18,7 +18,7 @@ import {
|
||||
Tr
|
||||
} from '@chakra-ui/react';
|
||||
import { useToast } from '@fastgpt/web/hooks/useToast';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { getApiSchemaByUrl, putUpdateHttpPlugin } from '@/web/core/app/api/tool';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { useContextSelector } from 'use-context-selector';
|
||||
@@ -88,7 +88,7 @@ const SchemaConfigModal = ({ onClose }: { onClose: () => void }) => {
|
||||
const headerSecret = watch('headerSecret');
|
||||
const apiSchemaStr = watch('apiSchemaStr');
|
||||
|
||||
const { runAsync: onClickUrlLoadApi, loading: isLoadingUrlApi } = useRequest2(
|
||||
const { runAsync: onClickUrlLoadApi, loading: isLoadingUrlApi } = useRequest(
|
||||
async () => {
|
||||
if (!schemaUrl || (!schemaUrl.startsWith('https://') && !schemaUrl.startsWith('http://'))) {
|
||||
return toast({
|
||||
@@ -105,7 +105,7 @@ const SchemaConfigModal = ({ onClose }: { onClose: () => void }) => {
|
||||
errorToast: t('common:plugin.Invalid Schema')
|
||||
}
|
||||
);
|
||||
const { runAsync: onUpdateHttpTool, loading: isUpdatingHttpTool } = useRequest2(
|
||||
const { runAsync: onUpdateHttpTool, loading: isUpdatingHttpTool } = useRequest(
|
||||
async (data: HttpToolsType) => {
|
||||
const apiData = await str2OpenApiSchema(data.apiSchemaStr || '');
|
||||
const toolList = await pathData2ToolList(apiData.pathData);
|
||||
|
||||
@@ -23,7 +23,7 @@ import { AppRoleList } from '@fastgpt/global/support/permission/app/constant';
|
||||
import Avatar from '@fastgpt/web/components/common/Avatar';
|
||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
import MyModal from '@fastgpt/web/components/common/MyModal';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useToast } from '@fastgpt/web/hooks/useToast';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import React, { useCallback } from 'react';
|
||||
@@ -55,7 +55,7 @@ const InfoModal = ({ onClose }: { onClose: () => void }) => {
|
||||
const avatar = watch('avatar');
|
||||
|
||||
// submit config
|
||||
const { runAsync: saveSubmitSuccess, loading: btnLoading } = useRequest2(
|
||||
const { runAsync: saveSubmitSuccess, loading: btnLoading } = useRequest(
|
||||
async (data: AppSchema) => {
|
||||
await updateAppDetail({
|
||||
name: data.name,
|
||||
@@ -105,7 +105,7 @@ const InfoModal = ({ onClose }: { onClose: () => void }) => {
|
||||
...props
|
||||
});
|
||||
|
||||
const { runAsync: resumeInheritPermission } = useRequest2(() => resumeInheritPer(appDetail._id), {
|
||||
const { runAsync: resumeInheritPermission } = useRequest(() => resumeInheritPer(appDetail._id), {
|
||||
errorToast: t('common:resume_failed'),
|
||||
onSuccess: () => {
|
||||
reloadApp();
|
||||
|
||||
@@ -17,7 +17,7 @@ import ChatItemContextProvider, { ChatItemContext } from '@/web/core/chat/contex
|
||||
import ChatRecordContextProvider, {
|
||||
ChatRecordContext
|
||||
} from '@/web/core/chat/context/chatRecordContext';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useContextSelector } from 'use-context-selector';
|
||||
import ChatQuoteList from '@/pageComponents/chat/ChatQuoteList';
|
||||
import { ChatTypeEnum } from '@/components/core/chat/ChatContainer/ChatBox/constants';
|
||||
@@ -60,7 +60,7 @@ const DetailLogsModal = ({
|
||||
const chatRecords = useContextSelector(ChatRecordContext, (v) => v.chatRecords);
|
||||
const totalRecordsCount = useContextSelector(ChatRecordContext, (v) => v.totalRecordsCount);
|
||||
|
||||
const { data: chat } = useRequest2(
|
||||
const { data: chat } = useRequest(
|
||||
async () => {
|
||||
const res = await getInitChatInfo({ appId, chatId, loadCustomFeedbacks: true });
|
||||
res.userAvatar = HUMAN_ICON;
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
} from '@chakra-ui/react';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { getFeedbackRecordIds } from '@/web/core/chat/feedback/api';
|
||||
import { eventBus, EventNameEnum } from '@/web/common/utils/eventbus';
|
||||
|
||||
@@ -194,7 +194,7 @@ export const DetailLogsModalFeedbackTypeFilter = ({
|
||||
const { t } = useTranslation();
|
||||
|
||||
// Get feedback record IDs when in feedback mode
|
||||
const { data: feedbackRecords, runAsync: loadFeedbackRecords } = useRequest2(
|
||||
const { data: feedbackRecords, runAsync: loadFeedbackRecords } = useRequest(
|
||||
async (_feedbackType = feedbackType, _unreadOnly = unreadOnly) => {
|
||||
if (!appId || !chatId || _feedbackType === 'all') return null;
|
||||
return await getFeedbackRecordIds({
|
||||
|
||||
@@ -17,7 +17,7 @@ import React, { useMemo, useState } from 'react';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { AppContext } from '../context';
|
||||
import { useContextSelector } from 'use-context-selector';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { getAppChartData, getAppTotalData } from '@/web/core/app/api/log';
|
||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
import {
|
||||
@@ -152,7 +152,7 @@ const LogChart = ({
|
||||
|
||||
const [offset, setOffset] = useState<string>(offsetOptions[0].value);
|
||||
|
||||
const { data: chartData, loading } = useRequest2(
|
||||
const { data: chartData, loading } = useRequest(
|
||||
async () => {
|
||||
return getAppChartData({
|
||||
appId,
|
||||
@@ -840,7 +840,7 @@ const TotalData = ({ appId }: { appId: string }) => {
|
||||
totalChats: 0,
|
||||
totalPoints: 0
|
||||
}
|
||||
} = useRequest2(
|
||||
} = useRequest(
|
||||
async () => {
|
||||
if (feConfigs?.isPlus) {
|
||||
return await getAppTotalData({ appId });
|
||||
|
||||
@@ -27,7 +27,7 @@ import Avatar from '@fastgpt/web/components/common/Avatar';
|
||||
import { useLocalStorageState } from 'ahooks';
|
||||
import { getLogKeys } from '@/web/core/app/api/log';
|
||||
import type { AppLogKeysType } from '@fastgpt/global/core/app/logs/type';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import {
|
||||
AppLogKeysEnum,
|
||||
AppLogKeysEnumMap,
|
||||
@@ -128,7 +128,7 @@ const LogTable = ({
|
||||
const [logKeys = DefaultAppLogKeys, setLogKeys] = useLocalStorageState<AppLogKeysType[]>(
|
||||
`app_log_keys_${appId}`
|
||||
);
|
||||
const { runAsync: fetchLogKeys, data: teamLogKeys } = useRequest2(
|
||||
const { runAsync: fetchLogKeys, data: teamLogKeys } = useRequest(
|
||||
async () => {
|
||||
return getLogKeys({ appId });
|
||||
},
|
||||
@@ -153,7 +153,7 @@ const LogTable = ({
|
||||
return !isEqual(teamLogKeysList, personalLogKeysList);
|
||||
}, [teamLogKeys, logKeys]);
|
||||
|
||||
const { runAsync: exportLogs } = useRequest2(async () => {
|
||||
const { runAsync: exportLogs } = useRequest(async () => {
|
||||
const enabledKeys = logKeys.filter((item) => item.enable).map((item) => item.key);
|
||||
const headerTitle = enabledKeys.map((k) => t(AppLogKeysEnumMap[k])).join(',');
|
||||
await downloadFetch({
|
||||
@@ -237,7 +237,7 @@ const LogTable = ({
|
||||
type: 'delete'
|
||||
});
|
||||
|
||||
const { runAsync: handleDelete } = useRequest2(
|
||||
const { runAsync: handleDelete } = useRequest(
|
||||
async (chatIds: string[]) => {
|
||||
await batchDeleteChatHistories({ appId, chatIds });
|
||||
await getData(pageNum);
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Box, Button, Flex } from '@chakra-ui/react';
|
||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import React from 'react';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { updateLogKeys } from '@/web/core/app/api/log';
|
||||
import type { AppLogKeysType } from '@fastgpt/global/core/app/logs/type';
|
||||
import type {
|
||||
@@ -27,7 +27,7 @@ const SyncLogKeysPopover = ({
|
||||
}) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const { runAsync: updateList, loading: updateLoading } = useRequest2(
|
||||
const { runAsync: updateList, loading: updateLoading } = useRequest(
|
||||
async (data: updateLogKeysBody) => {
|
||||
await updateLogKeys(data);
|
||||
},
|
||||
|
||||
@@ -9,7 +9,7 @@ import { cardStyles } from '../constants';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { type McpToolConfigType } from '@fastgpt/global/core/app/tool/mcpTool/type';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import Markdown from '@/components/Markdown';
|
||||
import { postRunMCPTool } from '@/web/core/app/api/tool';
|
||||
import { type StoreSecretValueType } from '@fastgpt/global/common/secret/type';
|
||||
@@ -41,7 +41,7 @@ const ChatTest = ({
|
||||
setOutput('');
|
||||
}, [currentTool, reset]);
|
||||
|
||||
const { runAsync: runTool, loading: isRunning } = useRequest2(
|
||||
const { runAsync: runTool, loading: isRunning } = useRequest(
|
||||
async (data: Record<string, any>) => {
|
||||
if (!currentTool) return;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import React, { useState } from 'react';
|
||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
import FormLabel from '@fastgpt/web/components/common/MyBox/FormLabel';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { AppContext } from '../context';
|
||||
import { useContextSelector } from 'use-context-selector';
|
||||
import MyIconButton from '@fastgpt/web/components/common/Icon/button';
|
||||
@@ -39,7 +39,7 @@ const EditForm = ({
|
||||
|
||||
const [toolDetail, setToolDetail] = useState<McpToolConfigType | null>(null);
|
||||
|
||||
const { runAsync: runGetMCPTools, loading: isGettingTools } = useRequest2(
|
||||
const { runAsync: runGetMCPTools, loading: isGettingTools } = useRequest(
|
||||
async (data: getMCPToolsBody) => await getMCPTools(data),
|
||||
{
|
||||
onSuccess: (res) => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Box, Button, Flex } from '@chakra-ui/react';
|
||||
import FolderPath from '@/components/common/folder/Path';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useContextSelector } from 'use-context-selector';
|
||||
import { AppContext } from '../context';
|
||||
import { getAppFolderPath } from '@/web/core/app/api/app';
|
||||
@@ -27,7 +27,7 @@ const Header = ({
|
||||
|
||||
const { lastAppListRouteType } = useSystemStore();
|
||||
|
||||
const { data: paths = [] } = useRequest2(
|
||||
const { data: paths = [] } = useRequest(
|
||||
() => getAppFolderPath({ sourceId: appId, type: 'parent' }),
|
||||
{
|
||||
manual: false,
|
||||
@@ -48,7 +48,7 @@ const Header = ({
|
||||
[router, lastAppListRouteType]
|
||||
);
|
||||
|
||||
const { runAsync: saveMCPTools, loading: isSavingMCPTools } = useRequest2(
|
||||
const { runAsync: saveMCPTools, loading: isSavingMCPTools } = useRequest(
|
||||
async () => {
|
||||
return await postUpdateMCPTools({ appId, url, toolList, headerSecret });
|
||||
},
|
||||
|
||||
@@ -19,7 +19,7 @@ import { useRouter } from 'next/router';
|
||||
|
||||
import AppCard from '../WorkflowComponents/AppCard';
|
||||
import { useSystem } from '@fastgpt/web/hooks/useSystem';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import MyModal from '@fastgpt/web/components/common/MyModal';
|
||||
import { formatTime2YMDHMS } from '@fastgpt/global/common/string/time';
|
||||
import { useToast } from '@fastgpt/web/hooks/useToast';
|
||||
@@ -75,7 +75,7 @@ const Header = () => {
|
||||
|
||||
const { lastAppListRouteType } = useSystemStore();
|
||||
|
||||
const { runAsync: onClickSave, loading } = useRequest2(
|
||||
const { runAsync: onClickSave, loading } = useRequest(
|
||||
async ({
|
||||
isPublish,
|
||||
versionName = formatTime2YMDHMS(new Date())
|
||||
|
||||
@@ -6,7 +6,7 @@ import type { DingtalkAppType, OutLinkEditType } from '@fastgpt/global/support/o
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { createShareChat, updateShareChat } from '@/web/support/outLink/api';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import BasicInfo from '../components/BasicInfo';
|
||||
import { getDocPath } from '@/web/common/system/doc';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
@@ -37,7 +37,7 @@ const DingTalkEditModal = ({
|
||||
defaultValues: defaultData
|
||||
});
|
||||
|
||||
const { runAsync: onclickCreate, loading: creating } = useRequest2(
|
||||
const { runAsync: onclickCreate, loading: creating } = useRequest(
|
||||
(e: Omit<OutLinkEditType<DingtalkAppType>, 'appId' | 'type'>) =>
|
||||
createShareChat({
|
||||
...e,
|
||||
@@ -55,7 +55,7 @@ const DingTalkEditModal = ({
|
||||
}
|
||||
);
|
||||
|
||||
const { runAsync: onclickUpdate, loading: updating } = useRequest2(
|
||||
const { runAsync: onclickUpdate, loading: updating } = useRequest(
|
||||
(e) =>
|
||||
updateShareChat({
|
||||
...e,
|
||||
|
||||
@@ -27,7 +27,7 @@ import dayjs from 'dayjs';
|
||||
import dynamic from 'next/dynamic';
|
||||
import MyMenu from '@fastgpt/web/components/common/MyMenu';
|
||||
import EmptyTip from '@fastgpt/web/components/common/EmptyTip';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { getDocPath } from '@/web/common/system/doc';
|
||||
|
||||
const DingTalkEditModal = dynamic(() => import('./DingTalkEditModal'));
|
||||
@@ -50,7 +50,7 @@ const DingTalk = ({ appId }: { appId: string }) => {
|
||||
data: shareChatList = [],
|
||||
loading: isFetching,
|
||||
runAsync: refetchShareChatList
|
||||
} = useRequest2(
|
||||
} = useRequest(
|
||||
() => getShareChatList<DingtalkAppType>({ appId, type: PublishChannelEnum.dingtalk }),
|
||||
{
|
||||
manual: false
|
||||
|
||||
@@ -6,7 +6,7 @@ import type { FeishuAppType, OutLinkEditType } from '@fastgpt/global/support/out
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { createShareChat, updateShareChat } from '@/web/support/outLink/api';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import BasicInfo from '../components/BasicInfo';
|
||||
import { getDocPath } from '@/web/common/system/doc';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
@@ -37,7 +37,7 @@ const FeiShuEditModal = ({
|
||||
defaultValues: defaultData
|
||||
});
|
||||
|
||||
const { runAsync: onclickCreate, loading: creating } = useRequest2(
|
||||
const { runAsync: onclickCreate, loading: creating } = useRequest(
|
||||
(e: Omit<OutLinkEditType<FeishuAppType>, 'appId' | 'type'>) =>
|
||||
createShareChat({
|
||||
...e,
|
||||
@@ -56,7 +56,7 @@ const FeiShuEditModal = ({
|
||||
}
|
||||
);
|
||||
|
||||
const { runAsync: onclickUpdate, loading: updating } = useRequest2(
|
||||
const { runAsync: onclickUpdate, loading: updating } = useRequest(
|
||||
(e) =>
|
||||
updateShareChat({
|
||||
...e,
|
||||
|
||||
@@ -27,7 +27,7 @@ import dayjs from 'dayjs';
|
||||
import dynamic from 'next/dynamic';
|
||||
import MyMenu from '@fastgpt/web/components/common/MyMenu';
|
||||
import EmptyTip from '@fastgpt/web/components/common/EmptyTip';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { getDocPath } from '@/web/common/system/doc';
|
||||
|
||||
const FeiShuEditModal = dynamic(() => import('./FeiShuEditModal'));
|
||||
@@ -49,7 +49,7 @@ const FeiShu = ({ appId }: { appId: string }) => {
|
||||
data: shareChatList = [],
|
||||
loading: isFetching,
|
||||
runAsync: refetchShareChatList
|
||||
} = useRequest2(
|
||||
} = useRequest(
|
||||
() => getShareChatList<FeishuAppType>({ appId, type: PublishChannelEnum.feishu }),
|
||||
{
|
||||
manual: false
|
||||
|
||||
@@ -46,7 +46,7 @@ import QuestionTip from '@fastgpt/web/components/common/MyTooltip/QuestionTip';
|
||||
import EmptyTip from '@fastgpt/web/components/common/EmptyTip';
|
||||
import FormLabel from '@fastgpt/web/components/common/MyBox/FormLabel';
|
||||
import MyBox from '@fastgpt/web/components/common/MyBox';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
|
||||
const SelectUsingWayModal = dynamic(() => import('./SelectUsingWayModal'));
|
||||
|
||||
@@ -287,7 +287,7 @@ function EditLinkModal({
|
||||
|
||||
const isEdit = useMemo(() => !!defaultData._id, [defaultData]);
|
||||
|
||||
const { runAsync: onclickCreate, loading: creating } = useRequest2(
|
||||
const { runAsync: onclickCreate, loading: creating } = useRequest(
|
||||
async (e: OutLinkEditType) =>
|
||||
createShareChat({
|
||||
...e,
|
||||
@@ -299,7 +299,7 @@ function EditLinkModal({
|
||||
onSuccess: onCreate
|
||||
}
|
||||
);
|
||||
const { runAsync: onclickUpdate, loading: updating } = useRequest2(putShareChat, {
|
||||
const { runAsync: onclickUpdate, loading: updating } = useRequest(putShareChat, {
|
||||
errorToast: t('common:update_failed'),
|
||||
onSuccess: onEdit
|
||||
});
|
||||
|
||||
+3
-3
@@ -6,7 +6,7 @@ import type { OffiAccountAppType, OutLinkEditType } from '@fastgpt/global/suppor
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { createShareChat, updateShareChat } from '@/web/support/outLink/api';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import BasicInfo from '../components/BasicInfo';
|
||||
import { getDocPath } from '@/web/common/system/doc';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
@@ -37,7 +37,7 @@ const OffiAccountEditModal = ({
|
||||
defaultValues: defaultData
|
||||
});
|
||||
|
||||
const { runAsync: onclickCreate, loading: creating } = useRequest2(
|
||||
const { runAsync: onclickCreate, loading: creating } = useRequest(
|
||||
(e: OutLinkEditType<OffiAccountAppType>) => {
|
||||
if (e?.app) {
|
||||
e.app.appId = e.app.appId?.trim();
|
||||
@@ -58,7 +58,7 @@ const OffiAccountEditModal = ({
|
||||
}
|
||||
);
|
||||
|
||||
const { runAsync: onclickUpdate, loading: updating } = useRequest2(
|
||||
const { runAsync: onclickUpdate, loading: updating } = useRequest(
|
||||
(e) => {
|
||||
if (e?.app) {
|
||||
e.app.appId = e.app.appId?.trim();
|
||||
|
||||
@@ -27,7 +27,7 @@ import dayjs from 'dayjs';
|
||||
import dynamic from 'next/dynamic';
|
||||
import MyMenu from '@fastgpt/web/components/common/MyMenu';
|
||||
import EmptyTip from '@fastgpt/web/components/common/EmptyTip';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { getDocPath } from '@/web/common/system/doc';
|
||||
|
||||
const OffiAccountEditModal = dynamic(() => import('./OffiAccountEditModal'));
|
||||
@@ -50,7 +50,7 @@ const OffiAccount = ({ appId }: { appId: string }) => {
|
||||
data: shareChatList = [],
|
||||
loading: isFetching,
|
||||
runAsync: refetchShareChatList
|
||||
} = useRequest2(
|
||||
} = useRequest(
|
||||
() => getShareChatList<OffiAccountAppType>({ appId, type: PublishChannelEnum.officialAccount }),
|
||||
{
|
||||
manual: false
|
||||
|
||||
@@ -4,7 +4,7 @@ import { useTranslation } from 'next-i18next';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import FormLabel from '@fastgpt/web/components/common/MyBox/FormLabel';
|
||||
import QuestionTip from '@fastgpt/web/components/common/MyTooltip/QuestionTip';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import {
|
||||
getPlaygroundVisibilityConfig,
|
||||
updatePlaygroundVisibilityConfig
|
||||
@@ -43,7 +43,7 @@ const PlaygroundVisibilityConfig = ({ appId }: { appId: string }) => {
|
||||
return '';
|
||||
}, [appId]);
|
||||
|
||||
useRequest2(() => getPlaygroundVisibilityConfig({ appId }), {
|
||||
useRequest(() => getPlaygroundVisibilityConfig({ appId }), {
|
||||
onSuccess: (data) => {
|
||||
reset({
|
||||
showRunningStatus: data.showRunningStatus,
|
||||
@@ -56,7 +56,7 @@ const PlaygroundVisibilityConfig = ({ appId }: { appId: string }) => {
|
||||
manual: false
|
||||
});
|
||||
|
||||
const { runAsync: saveConfig } = useRequest2(
|
||||
const { runAsync: saveConfig } = useRequest(
|
||||
async (data: PlaygroundVisibilityConfigType) => {
|
||||
return await updatePlaygroundVisibilityConfig({
|
||||
appId,
|
||||
|
||||
@@ -6,7 +6,7 @@ import type { WecomAppType, OutLinkEditType } from '@fastgpt/global/support/outL
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { createShareChat, updateShareChat } from '@/web/support/outLink/api';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { getDocPath } from '@/web/common/system/doc';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
@@ -45,7 +45,7 @@ const WecomEditModal = ({
|
||||
runAsync: onclickCreate,
|
||||
loading: creating,
|
||||
data: createShareId
|
||||
} = useRequest2(
|
||||
} = useRequest(
|
||||
(e) =>
|
||||
createShareChat({
|
||||
...e,
|
||||
@@ -68,7 +68,7 @@ const WecomEditModal = ({
|
||||
runAsync: onclickUpdate,
|
||||
loading: updating,
|
||||
data: updatedShareId
|
||||
} = useRequest2((e) => updateShareChat(e), {
|
||||
} = useRequest((e) => updateShareChat(e), {
|
||||
errorToast: t('common:update_failed'),
|
||||
successToast: t('common:update_success'),
|
||||
onSuccess: onEdit
|
||||
|
||||
@@ -26,7 +26,7 @@ import dayjs from 'dayjs';
|
||||
import dynamic from 'next/dynamic';
|
||||
import MyMenu from '@fastgpt/web/components/common/MyMenu';
|
||||
import EmptyTip from '@fastgpt/web/components/common/EmptyTip';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { getDocPath } from '@/web/common/system/doc';
|
||||
import { listCustomDomain } from '@/web/support/customDomain/api';
|
||||
|
||||
@@ -49,7 +49,7 @@ const Wecom = ({ appId }: { appId: string }) => {
|
||||
data: shareChatList = [],
|
||||
loading: isFetching,
|
||||
runAsync: refetchShareChatList
|
||||
} = useRequest2(() => getShareChatList<WecomAppType>({ appId, type: PublishChannelEnum.wecom }), {
|
||||
} = useRequest(() => getShareChatList<WecomAppType>({ appId, type: PublishChannelEnum.wecom }), {
|
||||
manual: false
|
||||
});
|
||||
|
||||
@@ -61,7 +61,7 @@ const Wecom = ({ appId }: { appId: string }) => {
|
||||
|
||||
const [showShareLink, setShowShareLink] = useState<string | null>(null);
|
||||
|
||||
const { data: customDomains = [] } = useRequest2(listCustomDomain, {
|
||||
const { data: customDomains = [] } = useRequest(listCustomDomain, {
|
||||
manual: false,
|
||||
refreshOnWindowFocus: true
|
||||
});
|
||||
|
||||
+2
-2
@@ -5,7 +5,7 @@ import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import MyImage from '@fastgpt/web/components/common/Image/MyImage';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { listCustomDomain } from '@/web/support/customDomain/api';
|
||||
import { useState, useMemo, useEffect } from 'react';
|
||||
import MySelect from '@fastgpt/web/components/common/MySelect';
|
||||
@@ -33,7 +33,7 @@ export const ShareLinkContainer = ({
|
||||
const { t } = useTranslation();
|
||||
const [customDomain, setCustomDomain] = useState<string | undefined>(undefined);
|
||||
|
||||
const { data: customDomainList = [] } = useRequest2(listCustomDomain, {
|
||||
const { data: customDomainList = [] } = useRequest(listCustomDomain, {
|
||||
manual: !showCustomDomainSelector
|
||||
});
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ import Tag from '@fastgpt/web/components/common/Tag';
|
||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
import MyPopover from '@fastgpt/web/components/common/MyPopover';
|
||||
import MyBox from '@fastgpt/web/components/common/MyBox';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useToast } from '@fastgpt/web/hooks/useToast';
|
||||
import type { AppVersionSchemaType, VersionListItemType } from '@fastgpt/global/core/app/version';
|
||||
import type { SimpleAppSnapshotType } from './SimpleApp/useSnapshots';
|
||||
@@ -198,7 +198,7 @@ const TeamCloud = ({
|
||||
|
||||
const { toast } = useToast();
|
||||
|
||||
const { runAsync: onChangeVersion, loading: isLoadingVersion } = useRequest2(
|
||||
const { runAsync: onChangeVersion, loading: isLoadingVersion } = useRequest(
|
||||
async (versionItem: VersionListItemType) => {
|
||||
const versionDetail = await getAppVersionDetail(versionItem._id, versionItem.appId);
|
||||
|
||||
@@ -212,7 +212,7 @@ const TeamCloud = ({
|
||||
}
|
||||
);
|
||||
|
||||
const { runAsync: onUpdateVersion, loading: isEditing } = useRequest2(
|
||||
const { runAsync: onUpdateVersion, loading: isEditing } = useRequest(
|
||||
async (item: VersionListItemType, name: string) => {
|
||||
await updateAppVersion({
|
||||
appId: item.appId,
|
||||
|
||||
@@ -20,7 +20,7 @@ import { AppContext } from '@/pageComponents/app/detail/context';
|
||||
import { useContextSelector } from 'use-context-selector';
|
||||
import MyMenu from '@fastgpt/web/components/common/MyMenu';
|
||||
import MyModal from '@fastgpt/web/components/common/MyModal';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { postTransition2Workflow } from '@/web/core/app/api/app';
|
||||
import { form2AppWorkflow } from '@/web/core/app/utils';
|
||||
import { type SimpleAppSnapshotType } from './useSnapshots';
|
||||
@@ -47,7 +47,7 @@ const AppCard = ({
|
||||
|
||||
// transition to workflow
|
||||
const [transitionCreateNew, setTransitionCreateNew] = useState<boolean>();
|
||||
const { runAsync: onTransition, loading: transiting } = useRequest2(
|
||||
const { runAsync: onTransition, loading: transiting } = useRequest(
|
||||
async () => {
|
||||
const { nodes, edges } = form2AppWorkflow(appForm, t);
|
||||
await onSaveApp({
|
||||
|
||||
@@ -2,7 +2,7 @@ import React, { useCallback, useEffect, useState } from 'react';
|
||||
import { useContextSelector } from 'use-context-selector';
|
||||
import { AppContext } from '../context';
|
||||
import FolderPath from '@/components/common/folder/Path';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { getAppFolderPath } from '@/web/core/app/api/app';
|
||||
import { Box, Flex, IconButton } from '@chakra-ui/react';
|
||||
import { useRouter } from 'next/router';
|
||||
@@ -61,7 +61,7 @@ const Header = ({
|
||||
|
||||
const { lastAppListRouteType } = useSystemStore();
|
||||
|
||||
const { data: paths = [] } = useRequest2(
|
||||
const { data: paths = [] } = useRequest(
|
||||
() => getAppFolderPath({ sourceId: appId, type: 'parent' }),
|
||||
{
|
||||
manual: false,
|
||||
@@ -81,7 +81,7 @@ const Header = ({
|
||||
[router, lastAppListRouteType]
|
||||
);
|
||||
|
||||
const { runAsync: onClickSave, loading } = useRequest2(
|
||||
const { runAsync: onClickSave, loading } = useRequest(
|
||||
async ({
|
||||
isPublish,
|
||||
versionName = formatTime2YMDHMS(new Date()),
|
||||
|
||||
@@ -5,7 +5,7 @@ import { useTranslation } from 'next-i18next';
|
||||
import { parseI18nString } from '@fastgpt/global/common/i18n/utils';
|
||||
import { Box, Button, Flex, Grid } from '@chakra-ui/react';
|
||||
import FillRowTabs from '@fastgpt/web/components/common/Tabs/FillRowTabs';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import EmptyTip from '@fastgpt/web/components/common/EmptyTip';
|
||||
import {
|
||||
type FlowNodeTemplateType,
|
||||
@@ -74,7 +74,7 @@ const ToolSelectModal = ({ onClose, ...props }: Props & { onClose: () => void })
|
||||
data: rawTemplates = [],
|
||||
runAsync: loadTemplates,
|
||||
loading: isLoading
|
||||
} = useRequest2(
|
||||
} = useRequest(
|
||||
async ({
|
||||
type = templateType,
|
||||
parentId = '',
|
||||
@@ -125,7 +125,7 @@ const ToolSelectModal = ({ onClose, ...props }: Props & { onClose: () => void })
|
||||
});
|
||||
}, [rawTemplates, selectedTagIds, templateType]);
|
||||
|
||||
const { data: paths = [] } = useRequest2(
|
||||
const { data: paths = [] } = useRequest(
|
||||
() => {
|
||||
if (templateType === TemplateTypeEnum.systemTools)
|
||||
return getAppToolPaths({ sourceId: parentId, type: 'current' });
|
||||
@@ -137,7 +137,7 @@ const ToolSelectModal = ({ onClose, ...props }: Props & { onClose: () => void })
|
||||
}
|
||||
);
|
||||
|
||||
const { data: allTags = [] } = useRequest2(getPluginToolTags, {
|
||||
const { data: allTags = [] } = useRequest(getPluginToolTags, {
|
||||
manual: false
|
||||
});
|
||||
|
||||
@@ -150,7 +150,7 @@ const ToolSelectModal = ({ onClose, ...props }: Props & { onClose: () => void })
|
||||
[loadTemplates]
|
||||
);
|
||||
|
||||
useRequest2(() => loadTemplates({ searchVal: searchKey }), {
|
||||
useRequest(() => loadTemplates({ searchVal: searchKey }), {
|
||||
manual: false,
|
||||
throttleWait: 300,
|
||||
refreshDeps: [searchKey]
|
||||
@@ -262,7 +262,7 @@ const RenderList = React.memo(function RenderList({
|
||||
const onCloseConfigTool = useCallback(() => setConfigTool(undefined), []);
|
||||
const { toast } = useToast();
|
||||
|
||||
const { runAsync: onClickAdd, loading: isLoading } = useRequest2(
|
||||
const { runAsync: onClickAdd, loading: isLoading } = useRequest(
|
||||
async (template: NodeTemplateListItemType) => {
|
||||
const res = await getToolPreviewNode({ appId: template.id });
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user