diff --git a/client/src/pages/app/detail/components/Charts/TotalUsage.tsx b/client/src/pages/app/detail/components/Charts/TotalUsage.tsx
index eee601074..aa3959b78 100644
--- a/client/src/pages/app/detail/components/Charts/TotalUsage.tsx
+++ b/client/src/pages/app/detail/components/Charts/TotalUsage.tsx
@@ -5,6 +5,8 @@ import { getAppTotalUsage } from '@/api/app';
import { useQuery } from '@tanstack/react-query';
import dayjs from 'dayjs';
import { formatPrice } from '@/utils/user';
+import Loading from '@/components/Loading';
+import { Box } from '@chakra-ui/react';
const map = {
blue: {
@@ -185,7 +187,11 @@ const TokenUsage = ({ appId }: { appId: string }) => {
myChart.current.resize();
}, [screenWidth]);
- return
;
+ return (
+
+
+
+ );
};
export default React.memo(TokenUsage);
diff --git a/client/src/pages/app/detail/components/Share.tsx b/client/src/pages/app/detail/components/Share.tsx
index 32261b1da..71b8118d7 100644
--- a/client/src/pages/app/detail/components/Share.tsx
+++ b/client/src/pages/app/detail/components/Share.tsx
@@ -37,6 +37,7 @@ import { useForm } from 'react-hook-form';
import { defaultShareChat } from '@/constants/model';
import type { ShareChatEditType } from '@/types/app';
import MyTooltip from '@/components/MyTooltip';
+import { useRequest } from '@/hooks/useRequest';
const Share = ({ appId }: { appId: string }) => {
const { toast } = useToast();
@@ -65,40 +66,21 @@ const Share = ({ appId }: { appId: string }) => {
refetch: refetchShareChatList
} = useQuery(['initShareChatList', appId], () => getShareChatList(appId));
- const onclickCreateShareChat = useCallback(
- async (e: ShareChatEditType) => {
- try {
- setIsLoading(true);
- const id = await createShareChat({
- ...e,
- appId
- });
- onCloseCreateShareChat();
- refetchShareChatList();
-
- const url = `对话地址为:${location.origin}/chat/share?shareId=${id}`;
- copyData(url, '已复制分享地址');
-
- resetShareChat(defaultShareChat);
- } catch (err) {
- toast({
- title: getErrText(err, '创建分享链接异常'),
- status: 'warning'
- });
- console.log(err);
- }
- setIsLoading(false);
- },
- [
- appId,
- copyData,
- onCloseCreateShareChat,
- refetchShareChatList,
- resetShareChat,
- setIsLoading,
- toast
- ]
- );
+ const { mutate: onclickCreateShareChat, isLoading: creating } = useRequest({
+ mutationFn: async (e: ShareChatEditType) =>
+ createShareChat({
+ ...e,
+ appId
+ }),
+ errorToast: '创建分享链接异常',
+ onSuccess(id) {
+ onCloseCreateShareChat();
+ refetchShareChatList();
+ const url = `对话地址为:${location.origin}/chat/share?shareId=${id}`;
+ copyData(url, '已复制分享地址');
+ resetShareChat(defaultShareChat);
+ }
+ });
// format share used token
const formatTokens = (tokens: number) => {
@@ -199,7 +181,7 @@ const Share = ({ appId }: { appId: string }) => {
{/* create shareChat modal */}
-
+
创建免登录窗口
@@ -259,7 +241,13 @@ const Share = ({ appId }: { appId: string }) => {
-
+
+
diff --git a/client/src/pages/app/detail/components/edit/components/ChatTest.tsx b/client/src/pages/app/detail/components/edit/components/ChatTest.tsx
index d91af01a5..656729213 100644
--- a/client/src/pages/app/detail/components/edit/components/ChatTest.tsx
+++ b/client/src/pages/app/detail/components/edit/components/ChatTest.tsx
@@ -105,15 +105,6 @@ const ChatTest = (
return (
<>
-
+
>
);
};
diff --git a/client/src/pages/app/detail/components/edit/index.tsx b/client/src/pages/app/detail/components/edit/index.tsx
index 96f8e8e5d..d640e9d95 100644
--- a/client/src/pages/app/detail/components/edit/index.tsx
+++ b/client/src/pages/app/detail/components/edit/index.tsx
@@ -280,9 +280,7 @@ const AppEdit = ({ app, fullScreen, onFullScreen }: Props) => {
}
+ icon={}
borderRadius={'md'}
borderColor={'myGray.300'}
variant={'base'}
@@ -305,7 +303,7 @@ const AppEdit = ({ app, fullScreen, onFullScreen }: Props) => {
}
+ icon={}
borderRadius={'lg'}
variant={'base'}
aria-label={'fullScreenLight'}
@@ -331,7 +329,7 @@ const AppEdit = ({ app, fullScreen, onFullScreen }: Props) => {
}
+ icon={}
borderRadius={'lg'}
aria-label={'save'}
variant={'base'}
@@ -344,7 +342,7 @@ const AppEdit = ({ app, fullScreen, onFullScreen }: Props) => {
}
+ icon={}
borderRadius={'lg'}
isLoading={isLoading}
aria-label={'save'}
@@ -353,6 +351,7 @@ const AppEdit = ({ app, fullScreen, onFullScreen }: Props) => {
{
}}
/>
-
+
{currentTab === TabEnum.settings && }
{currentTab === TabEnum.API && }
{currentTab === TabEnum.share && }