This commit is contained in:
Archer
2023-11-09 09:46:57 +08:00
committed by GitHub
parent 661ee79943
commit 8bb5588305
402 changed files with 9899 additions and 5967 deletions

View File

@@ -5,7 +5,7 @@ import MyIcon from '@/components/Icon';
import Tag from '@/components/Tag';
import Avatar from '@/components/Avatar';
import ToolMenu from './ToolMenu';
import { ChatItemType } from '@/types/chat';
import type { ChatItemType } from '@fastgpt/global/core/chat/type';
import { useRouter } from 'next/router';
const ChatHeader = ({

View File

@@ -21,6 +21,8 @@ import { useConfirm } from '@/web/common/hooks/useConfirm';
import Tabs from '@/components/Tabs';
import { useUserStore } from '@/web/support/user/useUserStore';
import { useQuery } from '@tanstack/react-query';
import { useAppStore } from '@/web/core/app/store/useAppStore';
import { TeamMemberRoleEnum } from '@fastgpt/global/support/user/team/constant';
type HistoryItemType = {
id: string;
@@ -63,7 +65,8 @@ const ChatHistorySlider = ({
const router = useRouter();
const { t } = useTranslation();
const { isPc } = useSystemStore();
const { myApps, loadMyApps, userInfo } = useUserStore();
const { myApps, loadMyApps } = useAppStore();
const { userInfo } = useUserStore();
const [currentTab, setCurrentTab] = useState<`${TabEnum}`>(TabEnum.history);
@@ -76,7 +79,7 @@ const ChatHistorySlider = ({
});
const { openConfirm, ConfirmModal } = useConfirm({
content: isShare
? t('chat.Confirm to clear share chat histroy')
? t('chat.Confirm to clear share chat history')
: t('chat.Confirm to clear history')
});
@@ -94,6 +97,11 @@ const ChatHistorySlider = ({
return loadMyApps(false);
});
const canRouteToDetail = useMemo(
() => appId && userInfo?.team.role !== TeamMemberRoleEnum.visitor,
[appId, userInfo?.team.role]
);
return (
<Flex
position={'relative'}
@@ -105,15 +113,15 @@ const ChatHistorySlider = ({
whiteSpace={'nowrap'}
>
{isPc && (
<MyTooltip label={appId ? t('app.App Detail') : ''} offset={[0, 0]}>
<MyTooltip label={canRouteToDetail ? t('app.App Detail') : ''} offset={[0, 0]}>
<Flex
pt={5}
pb={2}
px={[2, 5]}
alignItems={'center'}
cursor={appId ? 'pointer' : 'default'}
cursor={canRouteToDetail ? 'pointer' : 'default'}
onClick={() =>
appId &&
canRouteToDetail &&
router.replace({
pathname: '/app/detail',
query: { appId }

View File

@@ -1,16 +1,16 @@
import React from 'react';
import { Flex, Box, IconButton } from '@chakra-ui/react';
import { useRouter } from 'next/router';
import { useUserStore } from '@/web/support/user/useUserStore';
import { useQuery } from '@tanstack/react-query';
import { useTranslation } from 'react-i18next';
import MyIcon from '@/components/Icon';
import Avatar from '@/components/Avatar';
import { useAppStore } from '@/web/core/app/store/useAppStore';
const SliderApps = ({ appId }: { appId: string }) => {
const { t } = useTranslation();
const router = useRouter();
const { myApps, loadMyApps } = useUserStore();
const { myApps, loadMyApps } = useAppStore();
useQuery(['loadModels'], () => loadMyApps(false));

View File

@@ -1,6 +1,6 @@
import React, { useMemo } from 'react';
import { useChatBox } from '@/components/ChatBox';
import { ChatItemType } from '@/types/chat';
import type { ChatItemType } from '@fastgpt/global/core/chat/type.d';
import { Menu, MenuButton, MenuList, MenuItem, Box } from '@chakra-ui/react';
import MyIcon from '@/components/Icon';
import { useRouter } from 'next/router';