mirror of
https://github.com/labring/FastGPT.git
synced 2025-10-17 08:37:59 +00:00
perf: work order tip (#3874)
This commit is contained in:
1
packages/global/support/user/type.d.ts
vendored
1
packages/global/support/user/type.d.ts
vendored
@@ -27,7 +27,6 @@ export type UserType = {
|
|||||||
timezone: string;
|
timezone: string;
|
||||||
promotionRate: UserModelSchema['promotionRate'];
|
promotionRate: UserModelSchema['promotionRate'];
|
||||||
team: TeamTmbItemType;
|
team: TeamTmbItemType;
|
||||||
standardInfo?: standardInfoType;
|
|
||||||
notificationAccount?: string;
|
notificationAccount?: string;
|
||||||
permission: TeamPermission;
|
permission: TeamPermission;
|
||||||
contact?: string;
|
contact?: string;
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
<svg width="29" height="28" viewBox="0 0 29 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
<svg viewBox="0 0 29 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
<path d="M8.49993 10.1261C8.49993 9.48174 9.02226 8.9594 9.6666 8.9594H14.3333C14.9776 8.9594 15.4999 9.48174 15.4999 10.1261C15.4999 10.7704 14.9776 11.2927 14.3333 11.2927H9.6666C9.02226 11.2927 8.49993 10.7704 8.49993 10.1261Z" fill="url(#paint0_linear_17422_2138)"/>
|
<path d="M8.49993 10.1261C8.49993 9.48174 9.02226 8.9594 9.6666 8.9594H14.3333C14.9776 8.9594 15.4999 9.48174 15.4999 10.1261C15.4999 10.7704 14.9776 11.2927 14.3333 11.2927H9.6666C9.02226 11.2927 8.49993 10.7704 8.49993 10.1261Z" fill="url(#paint0_linear_17422_2138)"/>
|
||||||
<path d="M8.49993 14.7927C8.49993 14.1484 9.02226 13.6261 9.6666 13.6261H18.4041C19.0485 13.6261 19.5708 14.1484 19.5708 14.7927C19.5708 15.4371 19.0485 15.9594 18.4041 15.9594H9.6666C9.02226 15.9594 8.49993 15.4371 8.49993 14.7927Z" fill="url(#paint1_linear_17422_2138)"/>
|
<path d="M8.49993 14.7927C8.49993 14.1484 9.02226 13.6261 9.6666 13.6261H18.4041C19.0485 13.6261 19.5708 14.1484 19.5708 14.7927C19.5708 15.4371 19.0485 15.9594 18.4041 15.9594H9.6666C9.02226 15.9594 8.49993 15.4371 8.49993 14.7927Z" fill="url(#paint1_linear_17422_2138)"/>
|
||||||
<path d="M17.6859 9.1641C17.3948 9.37757 17.2057 9.72212 17.2057 10.1108V11.2504C17.2057 11.2738 17.2247 11.2927 17.248 11.2927H18.3745C18.7286 11.2927 19.0462 11.1358 19.262 10.8878L25.8249 4.32494C26.2805 3.86933 26.2805 3.13063 25.8249 2.67502C25.3693 2.21941 24.6306 2.21941 24.175 2.67502L17.6859 9.1641Z" fill="url(#paint2_linear_17422_2138)"/>
|
<path d="M17.6859 9.1641C17.3948 9.37757 17.2057 9.72212 17.2057 10.1108V11.2504C17.2057 11.2738 17.2247 11.2927 17.248 11.2927H18.3745C18.7286 11.2927 19.0462 11.1358 19.262 10.8878L25.8249 4.32494C26.2805 3.86933 26.2805 3.13063 25.8249 2.67502C25.3693 2.21941 24.6306 2.21941 24.175 2.67502L17.6859 9.1641Z" fill="url(#paint2_linear_17422_2138)"/>
|
||||||
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.6 KiB |
@@ -1012,6 +1012,7 @@
|
|||||||
"plugin.go to laf": "Go to Write",
|
"plugin.go to laf": "Go to Write",
|
||||||
"plugin.path": "Path",
|
"plugin.path": "Path",
|
||||||
"prompt_input_placeholder": "Please enter the prompt word",
|
"prompt_input_placeholder": "Please enter the prompt word",
|
||||||
|
"question_feedback": "Work order",
|
||||||
"read_quote": "View citations",
|
"read_quote": "View citations",
|
||||||
"required": "Required",
|
"required": "Required",
|
||||||
"resume_failed": "Resume Failed",
|
"resume_failed": "Resume Failed",
|
||||||
|
@@ -1015,6 +1015,7 @@
|
|||||||
"plugin.go to laf": "去编写",
|
"plugin.go to laf": "去编写",
|
||||||
"plugin.path": "路径",
|
"plugin.path": "路径",
|
||||||
"prompt_input_placeholder": "请输入提示词",
|
"prompt_input_placeholder": "请输入提示词",
|
||||||
|
"question_feedback": "工单咨询",
|
||||||
"read_quote": "查看引用",
|
"read_quote": "查看引用",
|
||||||
"required": "必须",
|
"required": "必须",
|
||||||
"resume_failed": "恢复失败",
|
"resume_failed": "恢复失败",
|
||||||
@@ -1283,6 +1284,5 @@
|
|||||||
"xx_search_result": "{{key}} 的搜索结果",
|
"xx_search_result": "{{key}} 的搜索结果",
|
||||||
"yes": "是",
|
"yes": "是",
|
||||||
"yesterday": "昨天",
|
"yesterday": "昨天",
|
||||||
"yesterday_detail_time": "昨天 {{time}}",
|
"yesterday_detail_time": "昨天 {{time}}"
|
||||||
"question_feedback": "问题反馈"
|
|
||||||
}
|
}
|
||||||
|
@@ -1011,6 +1011,7 @@
|
|||||||
"plugin.go to laf": "前往編寫",
|
"plugin.go to laf": "前往編寫",
|
||||||
"plugin.path": "路徑",
|
"plugin.path": "路徑",
|
||||||
"prompt_input_placeholder": "請輸入提示詞",
|
"prompt_input_placeholder": "請輸入提示詞",
|
||||||
|
"question_feedback": "工單諮詢",
|
||||||
"read_quote": "查看引用",
|
"read_quote": "查看引用",
|
||||||
"required": "必填",
|
"required": "必填",
|
||||||
"resume_failed": "恢復失敗",
|
"resume_failed": "恢復失敗",
|
||||||
|
@@ -1,33 +1,64 @@
|
|||||||
|
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||||
import { getWorkorderURL } from '@/web/common/workorder/api';
|
import { getWorkorderURL } from '@/web/common/workorder/api';
|
||||||
|
import { useUserStore } from '@/web/support/user/useUserStore';
|
||||||
import { Box, Flex } from '@chakra-ui/react';
|
import { Box, Flex } from '@chakra-ui/react';
|
||||||
|
import { StandardSubLevelEnum } from '@fastgpt/global/support/wallet/sub/constants';
|
||||||
import Icon from '@fastgpt/web/components/common/Icon';
|
import Icon from '@fastgpt/web/components/common/Icon';
|
||||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||||
|
import { useSystem } from '@fastgpt/web/hooks/useSystem';
|
||||||
import { useToggle } from 'ahooks';
|
import { useToggle } from 'ahooks';
|
||||||
import { useTranslation } from 'next-i18next';
|
import { useTranslation } from 'next-i18next';
|
||||||
|
import { useRouter } from 'next/router';
|
||||||
|
import { useMemo } from 'react';
|
||||||
|
|
||||||
|
const WorkOrderShowRouter: { [key: string]: boolean } = {
|
||||||
|
'/app/list': true,
|
||||||
|
'/dataset/list': true,
|
||||||
|
'/toolkit': true
|
||||||
|
};
|
||||||
|
|
||||||
function WorkorderButton() {
|
function WorkorderButton() {
|
||||||
|
const router = useRouter();
|
||||||
const [open, setOpen] = useToggle(true);
|
const [open, setOpen] = useToggle(true);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const { data, runAsync } = useRequest2(getWorkorderURL, {
|
const { feConfigs, subPlans } = useSystemStore();
|
||||||
manual: true
|
const { teamPlanStatus } = useUserStore();
|
||||||
|
|
||||||
|
const { isPc } = useSystem();
|
||||||
|
|
||||||
|
const { runAsync: onFeedback } = useRequest2(getWorkorderURL, {
|
||||||
|
manual: true,
|
||||||
|
onSuccess(data) {
|
||||||
|
if (data) {
|
||||||
|
window.open(data.redirectUrl);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const onFeedback = async () => {
|
const showWorkorder = WorkOrderShowRouter[router.pathname];
|
||||||
await runAsync();
|
|
||||||
if (data) {
|
const isPlanUser = useMemo(() => {
|
||||||
window.open(data.redirectUrl);
|
if (!teamPlanStatus) return false;
|
||||||
}
|
if (teamPlanStatus.standard?.currentSubLevel !== StandardSubLevelEnum.free) return true;
|
||||||
};
|
if (teamPlanStatus.datasetMaxSize !== subPlans?.standard?.free?.maxDatasetSize) return true;
|
||||||
return (
|
if (teamPlanStatus.totalPoints !== subPlans?.standard?.free?.totalPoints) return true;
|
||||||
|
return false;
|
||||||
|
}, [
|
||||||
|
subPlans?.standard?.free?.maxDatasetSize,
|
||||||
|
subPlans?.standard?.free?.totalPoints,
|
||||||
|
teamPlanStatus
|
||||||
|
]);
|
||||||
|
|
||||||
|
return showWorkorder && feConfigs?.show_workorder && isPlanUser && isPc ? (
|
||||||
<>
|
<>
|
||||||
{open ? (
|
{open ? (
|
||||||
<Flex
|
<Flex
|
||||||
position="fixed"
|
position="fixed"
|
||||||
bottom="20%"
|
bottom="10%"
|
||||||
right="0"
|
right="0"
|
||||||
height="62px"
|
height="56px"
|
||||||
width="58px"
|
width="56px"
|
||||||
zIndex={100}
|
zIndex={100}
|
||||||
boxShadow="0px 12px 32px -4px #00175633"
|
boxShadow="0px 12px 32px -4px #00175633"
|
||||||
alignItems="center"
|
alignItems="center"
|
||||||
@@ -39,16 +70,16 @@ function WorkorderButton() {
|
|||||||
borderColor={'#DFE6F2'}
|
borderColor={'#DFE6F2'}
|
||||||
>
|
>
|
||||||
<Box
|
<Box
|
||||||
zIndex={101}
|
zIndex={10}
|
||||||
width="14px"
|
width="1rem"
|
||||||
height="14px"
|
height="1rem"
|
||||||
position="absolute"
|
position="absolute"
|
||||||
left="-6px"
|
left="-6px"
|
||||||
top="-6px"
|
top="-6px"
|
||||||
borderRadius="full"
|
borderRadius="full"
|
||||||
background="white"
|
background="white"
|
||||||
border="1px"
|
border="1px"
|
||||||
borderColor={'myGray.25'}
|
borderColor={'myGray.100'}
|
||||||
bgColor="myGray.25"
|
bgColor="myGray.25"
|
||||||
_hover={{
|
_hover={{
|
||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
@@ -73,8 +104,8 @@ function WorkorderButton() {
|
|||||||
borderBottomLeftRadius="8px"
|
borderBottomLeftRadius="8px"
|
||||||
onClick={onFeedback}
|
onClick={onFeedback}
|
||||||
>
|
>
|
||||||
<Icon name="feedback" width="28px" height="28px" />
|
<Icon name="feedback" width="24px" height="24px" />
|
||||||
<Box fontSize="11px" fontWeight="500">
|
<Box fontSize="xs" fontWeight="500">
|
||||||
{t('common:question_feedback')}
|
{t('common:question_feedback')}
|
||||||
</Box>
|
</Box>
|
||||||
</Flex>
|
</Flex>
|
||||||
@@ -82,7 +113,7 @@ function WorkorderButton() {
|
|||||||
) : (
|
) : (
|
||||||
<Flex
|
<Flex
|
||||||
position="fixed"
|
position="fixed"
|
||||||
bottom="20%"
|
bottom="10%"
|
||||||
right="0"
|
right="0"
|
||||||
height="44px"
|
height="44px"
|
||||||
width="19px"
|
width="19px"
|
||||||
@@ -106,7 +137,7 @@ function WorkorderButton() {
|
|||||||
</Flex>
|
</Flex>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
);
|
) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default WorkorderButton;
|
export default WorkorderButton;
|
@@ -3,7 +3,6 @@ import { useUserStore } from '@/web/support/user/useUserStore';
|
|||||||
import { useQuery } from '@tanstack/react-query';
|
import { useQuery } from '@tanstack/react-query';
|
||||||
import { useTranslation } from 'next-i18next';
|
import { useTranslation } from 'next-i18next';
|
||||||
import { useToast } from '@fastgpt/web/hooks/useToast';
|
import { useToast } from '@fastgpt/web/hooks/useToast';
|
||||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
|
||||||
|
|
||||||
const unAuthPage: { [key: string]: boolean } = {
|
const unAuthPage: { [key: string]: boolean } = {
|
||||||
'/': true,
|
'/': true,
|
||||||
|
@@ -14,7 +14,7 @@ import { useSystem } from '@fastgpt/web/hooks/useSystem';
|
|||||||
import { useDebounceEffect, useMount } from 'ahooks';
|
import { useDebounceEffect, useMount } from 'ahooks';
|
||||||
import { useTranslation } from 'next-i18next';
|
import { useTranslation } from 'next-i18next';
|
||||||
import { useToast } from '@fastgpt/web/hooks/useToast';
|
import { useToast } from '@fastgpt/web/hooks/useToast';
|
||||||
import WorkorderButton from '../support/workorder/WorkorderButton';
|
import WorkorderButton from './WorkorderButton';
|
||||||
|
|
||||||
const Navbar = dynamic(() => import('./navbar'));
|
const Navbar = dynamic(() => import('./navbar'));
|
||||||
const NavbarPhone = dynamic(() => import('./navbarPhone'));
|
const NavbarPhone = dynamic(() => import('./navbarPhone'));
|
||||||
@@ -57,7 +57,8 @@ const Layout = ({ children }: { children: JSX.Element }) => {
|
|||||||
const { loading, feConfigs, notSufficientModalType, llmModelList, embeddingModelList } =
|
const { loading, feConfigs, notSufficientModalType, llmModelList, embeddingModelList } =
|
||||||
useSystemStore();
|
useSystemStore();
|
||||||
const { isPc } = useSystem();
|
const { isPc } = useSystem();
|
||||||
const { userInfo, isUpdateNotification, setIsUpdateNotification } = useUserStore();
|
const { userInfo, teamPlanStatus, isUpdateNotification, setIsUpdateNotification } =
|
||||||
|
useUserStore();
|
||||||
const { setUserDefaultLng } = useI18nLng();
|
const { setUserDefaultLng } = useI18nLng();
|
||||||
|
|
||||||
const isChatPage = useMemo(
|
const isChatPage = useMemo(
|
||||||
@@ -122,7 +123,6 @@ const Layout = ({ children }: { children: JSX.Element }) => {
|
|||||||
<Auth>
|
<Auth>
|
||||||
<Box h={'100%'} position={'fixed'} left={0} top={0} w={navbarWidth}>
|
<Box h={'100%'} position={'fixed'} left={0} top={0} w={navbarWidth}>
|
||||||
<Navbar unread={unread} />
|
<Navbar unread={unread} />
|
||||||
{feConfigs.show_workorder && <WorkorderButton />}
|
|
||||||
</Box>
|
</Box>
|
||||||
<Box h={'100%'} ml={navbarWidth} overflow={'overlay'}>
|
<Box h={'100%'} ml={navbarWidth} overflow={'overlay'}>
|
||||||
{children}
|
{children}
|
||||||
@@ -161,6 +161,7 @@ const Layout = ({ children }: { children: JSX.Element }) => {
|
|||||||
{!!userInfo && importantInforms.length > 0 && (
|
{!!userInfo && importantInforms.length > 0 && (
|
||||||
<ImportantInform informs={importantInforms} refetch={refetchUnRead} />
|
<ImportantInform informs={importantInforms} refetch={refetchUnRead} />
|
||||||
)}
|
)}
|
||||||
|
<WorkorderButton />
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
@@ -42,6 +42,8 @@ import AccountContainer from '@/pageComponents/account/AccountContainer';
|
|||||||
import { serviceSideProps } from '@fastgpt/web/common/system/nextjs';
|
import { serviceSideProps } from '@fastgpt/web/common/system/nextjs';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
import TeamSelector from '@/pageComponents/account/TeamSelector';
|
import TeamSelector from '@/pageComponents/account/TeamSelector';
|
||||||
|
import { getWorkorderURL } from '@/web/common/workorder/api';
|
||||||
|
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||||
|
|
||||||
const StandDetailModal = dynamic(
|
const StandDetailModal = dynamic(
|
||||||
() => import('@/pageComponents/account/info/standardDetailModal'),
|
() => import('@/pageComponents/account/info/standardDetailModal'),
|
||||||
@@ -580,9 +582,19 @@ const ButtonStyles = {
|
|||||||
};
|
};
|
||||||
const Other = ({ onOpenContact }: { onOpenContact: () => void }) => {
|
const Other = ({ onOpenContact }: { onOpenContact: () => void }) => {
|
||||||
const { feConfigs } = useSystemStore();
|
const { feConfigs } = useSystemStore();
|
||||||
|
const { teamPlanStatus } = useUserStore();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { isPc } = useSystem();
|
const { isPc } = useSystem();
|
||||||
|
|
||||||
|
const { runAsync: onFeedback } = useRequest2(getWorkorderURL, {
|
||||||
|
manual: true,
|
||||||
|
onSuccess(data) {
|
||||||
|
if (data) {
|
||||||
|
window.open(data.redirectUrl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box>
|
<Box>
|
||||||
<Grid gridGap={4} mt={3}>
|
<Grid gridGap={4} mt={3}>
|
||||||
@@ -619,6 +631,16 @@ const Other = ({ onOpenContact }: { onOpenContact: () => void }) => {
|
|||||||
</Box>
|
</Box>
|
||||||
</Flex>
|
</Flex>
|
||||||
)}
|
)}
|
||||||
|
{feConfigs?.show_workorder &&
|
||||||
|
teamPlanStatus &&
|
||||||
|
teamPlanStatus.standard?.currentSubLevel !== StandardSubLevelEnum.free && (
|
||||||
|
<Flex onClick={onFeedback} {...ButtonStyles}>
|
||||||
|
<MyIcon name={'feedback'} w={'18px'} color={'myGray.600'} />
|
||||||
|
<Box ml={2} flex={1}>
|
||||||
|
{t('common:question_feedback')}
|
||||||
|
</Box>
|
||||||
|
</Flex>
|
||||||
|
)}
|
||||||
</Grid>
|
</Grid>
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user