mirror of
https://github.com/labring/FastGPT.git
synced 2026-04-30 02:00:50 +08:00
free plan workorder entrance (#6085)
This commit is contained in:
@@ -14,6 +14,7 @@ export enum TeamErrEnum {
|
|||||||
appFolderAmountNotEnough = 'appFolderAmountNotEnough',
|
appFolderAmountNotEnough = 'appFolderAmountNotEnough',
|
||||||
websiteSyncNotEnough = 'websiteSyncNotEnough',
|
websiteSyncNotEnough = 'websiteSyncNotEnough',
|
||||||
reRankNotEnough = 'reRankNotEnough',
|
reRankNotEnough = 'reRankNotEnough',
|
||||||
|
ticketNotAvailable = 'ticketNotAvailable',
|
||||||
groupNameEmpty = 'groupNameEmpty',
|
groupNameEmpty = 'groupNameEmpty',
|
||||||
groupNameDuplicate = 'groupNameDuplicate',
|
groupNameDuplicate = 'groupNameDuplicate',
|
||||||
groupNotExist = 'groupNotExist',
|
groupNotExist = 'groupNotExist',
|
||||||
@@ -78,6 +79,10 @@ const teamErr = [
|
|||||||
statusText: TeamErrEnum.reRankNotEnough,
|
statusText: TeamErrEnum.reRankNotEnough,
|
||||||
message: i18nT('common:code_error.team_error.re_rank_not_enough')
|
message: i18nT('common:code_error.team_error.re_rank_not_enough')
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
statusText: TeamErrEnum.ticketNotAvailable,
|
||||||
|
message: i18nT('common:code_error.team_error.ticket_not_available')
|
||||||
|
},
|
||||||
{
|
{
|
||||||
statusText: TeamErrEnum.groupNameEmpty,
|
statusText: TeamErrEnum.groupNameEmpty,
|
||||||
message: i18nT('common:code_error.team_error.group_name_empty')
|
message: i18nT('common:code_error.team_error.group_name_empty')
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ export type SubPlanType = {
|
|||||||
[SubTypeEnum.standard]?: StandSubPlanLevelMapType;
|
[SubTypeEnum.standard]?: StandSubPlanLevelMapType;
|
||||||
planDescriptionUrl?: string;
|
planDescriptionUrl?: string;
|
||||||
appRegistrationUrl?: string;
|
appRegistrationUrl?: string;
|
||||||
|
communitySupportTip?: string;
|
||||||
[SubTypeEnum.extraDatasetSize]: {
|
[SubTypeEnum.extraDatasetSize]: {
|
||||||
price: number;
|
price: number;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -195,6 +195,7 @@
|
|||||||
"code_error.team_error.over_size": "Team members exceed limit",
|
"code_error.team_error.over_size": "Team members exceed limit",
|
||||||
"code_error.team_error.plugin_amount_not_enough": "Plugin Limit Reached",
|
"code_error.team_error.plugin_amount_not_enough": "Plugin Limit Reached",
|
||||||
"code_error.team_error.re_rank_not_enough": "Search rearrangement cannot be used in the free version~",
|
"code_error.team_error.re_rank_not_enough": "Search rearrangement cannot be used in the free version~",
|
||||||
|
"code_error.team_error.ticket_not_available": "The current package does not support work order services. You can go to the community to get help for free ~",
|
||||||
"code_error.team_error.too_many_invitations": "You have reached the maximum number of active invitation links, please clean up some links first",
|
"code_error.team_error.too_many_invitations": "You have reached the maximum number of active invitation links, please clean up some links first",
|
||||||
"code_error.team_error.un_auth": "Unauthorized to Operate This Team",
|
"code_error.team_error.un_auth": "Unauthorized to Operate This Team",
|
||||||
"code_error.team_error.user_not_active": "The user did not accept or has left the team",
|
"code_error.team_error.user_not_active": "The user did not accept or has left the team",
|
||||||
@@ -1224,6 +1225,9 @@
|
|||||||
"support.wallet.subscription.function.Max members": "{{amount}} Member",
|
"support.wallet.subscription.function.Max members": "{{amount}} Member",
|
||||||
"support.wallet.subscription.function.Points": "{{amount}} points",
|
"support.wallet.subscription.function.Points": "{{amount}} points",
|
||||||
"support.wallet.subscription.function.Requests per minute": "{{amount}} QPM",
|
"support.wallet.subscription.function.Requests per minute": "{{amount}} QPM",
|
||||||
|
"support.wallet.subscription.function.Ticket response time": "{{amount}} hours ticket support response",
|
||||||
|
"support.wallet.subscription.function.Community free support": "Community free support",
|
||||||
|
"support.wallet.subscription.function.Community support tip": "Visit the FastGPT community for free help and technical support",
|
||||||
"support.wallet.subscription.function.Website sync per dataset": "Single knowledge base {{amount}} web pages synchronized",
|
"support.wallet.subscription.function.Website sync per dataset": "Single knowledge base {{amount}} web pages synchronized",
|
||||||
"support.wallet.subscription.function.custom domain tip": "The number of custom domain names that the team can configure, which can currently be used to access Wecom intelligent robots",
|
"support.wallet.subscription.function.custom domain tip": "The number of custom domain names that the team can configure, which can currently be used to access Wecom intelligent robots",
|
||||||
"support.wallet.subscription.mode.Month": "Month",
|
"support.wallet.subscription.mode.Month": "Month",
|
||||||
|
|||||||
@@ -196,6 +196,7 @@
|
|||||||
"code_error.team_error.over_size": "团队成员超出限制",
|
"code_error.team_error.over_size": "团队成员超出限制",
|
||||||
"code_error.team_error.plugin_amount_not_enough": "插件数量已达上限~",
|
"code_error.team_error.plugin_amount_not_enough": "插件数量已达上限~",
|
||||||
"code_error.team_error.re_rank_not_enough": "免费版无法使用检索重排~",
|
"code_error.team_error.re_rank_not_enough": "免费版无法使用检索重排~",
|
||||||
|
"code_error.team_error.ticket_not_available": "当前套餐暂不支持工单服务,可以前往社区免费获取帮助~",
|
||||||
"code_error.team_error.too_many_invitations": "您的有效邀请链接数已达上限,请先清理链接",
|
"code_error.team_error.too_many_invitations": "您的有效邀请链接数已达上限,请先清理链接",
|
||||||
"code_error.team_error.un_auth": "无权操作该团队",
|
"code_error.team_error.un_auth": "无权操作该团队",
|
||||||
"code_error.team_error.user_not_active": "用户未接受或已离开团队",
|
"code_error.team_error.user_not_active": "用户未接受或已离开团队",
|
||||||
@@ -1234,6 +1235,8 @@
|
|||||||
"support.wallet.subscription.function.Points": "{{amount}} 积分",
|
"support.wallet.subscription.function.Points": "{{amount}} 积分",
|
||||||
"support.wallet.subscription.function.Requests per minute": "{{amount}} QPM",
|
"support.wallet.subscription.function.Requests per minute": "{{amount}} QPM",
|
||||||
"support.wallet.subscription.function.Ticket response time": "{{amount}} 小时工单支持响应",
|
"support.wallet.subscription.function.Ticket response time": "{{amount}} 小时工单支持响应",
|
||||||
|
"support.wallet.subscription.function.Community free support": "社区免费支持",
|
||||||
|
"support.wallet.subscription.function.Community support tip": "可前往 FastGPT 社区免费获取帮助和技术支持",
|
||||||
"support.wallet.subscription.function.Website sync per dataset": "站点同步最大 {{amount}} 页",
|
"support.wallet.subscription.function.Website sync per dataset": "站点同步最大 {{amount}} 页",
|
||||||
"support.wallet.subscription.function.custom domain tip": "团队可以配置的自定义域名数量,目前可用于接入企微智能机器人",
|
"support.wallet.subscription.function.custom domain tip": "团队可以配置的自定义域名数量,目前可用于接入企微智能机器人",
|
||||||
"support.wallet.subscription.function.qpm tip": "主要指团队每分钟请求 Agent 的最大次数,与单个 Agent 复杂度无关。其他 OpenAPI 接口也受此影响,每个接口单独计算",
|
"support.wallet.subscription.function.qpm tip": "主要指团队每分钟请求 Agent 的最大次数,与单个 Agent 复杂度无关。其他 OpenAPI 接口也受此影响,每个接口单独计算",
|
||||||
|
|||||||
@@ -195,6 +195,7 @@
|
|||||||
"code_error.team_error.over_size": "團隊成員超出限制",
|
"code_error.team_error.over_size": "團隊成員超出限制",
|
||||||
"code_error.team_error.plugin_amount_not_enough": "已達外掛程式數量上限",
|
"code_error.team_error.plugin_amount_not_enough": "已達外掛程式數量上限",
|
||||||
"code_error.team_error.re_rank_not_enough": "免費版無法使用檢索重排~",
|
"code_error.team_error.re_rank_not_enough": "免費版無法使用檢索重排~",
|
||||||
|
"code_error.team_error.ticket_not_available": "當前套餐暫不支持工單服務,可以前往社區免費獲取幫助~",
|
||||||
"code_error.team_error.too_many_invitations": "您的有效邀請連結數已達上限,請先清理連結",
|
"code_error.team_error.too_many_invitations": "您的有效邀請連結數已達上限,請先清理連結",
|
||||||
"code_error.team_error.un_auth": "無權操作此團隊",
|
"code_error.team_error.un_auth": "無權操作此團隊",
|
||||||
"code_error.team_error.user_not_active": "使用者未接受或已離開團隊",
|
"code_error.team_error.user_not_active": "使用者未接受或已離開團隊",
|
||||||
@@ -1221,6 +1222,9 @@
|
|||||||
"support.wallet.subscription.function.Max members": "{{amount}} 個團隊成員",
|
"support.wallet.subscription.function.Max members": "{{amount}} 個團隊成員",
|
||||||
"support.wallet.subscription.function.Points": "{{amount}} 積分",
|
"support.wallet.subscription.function.Points": "{{amount}} 積分",
|
||||||
"support.wallet.subscription.function.Requests per minute": "{{amount}} QPM",
|
"support.wallet.subscription.function.Requests per minute": "{{amount}} QPM",
|
||||||
|
"support.wallet.subscription.function.Ticket response time": "{{amount}} 小時工單支持響應",
|
||||||
|
"support.wallet.subscription.function.Community free support": "社群免費支持",
|
||||||
|
"support.wallet.subscription.function.Community support tip": "可前往 FastGPT 社群免費獲取幫助和技術支持",
|
||||||
"support.wallet.subscription.function.Website sync per dataset": "單知識庫 {{amount}} 個網頁同步",
|
"support.wallet.subscription.function.Website sync per dataset": "單知識庫 {{amount}} 個網頁同步",
|
||||||
"support.wallet.subscription.function.custom domain tip": "團隊可以配置的自定義域名數量,目前可用於接入企微智能機器人",
|
"support.wallet.subscription.function.custom domain tip": "團隊可以配置的自定義域名數量,目前可用於接入企微智能機器人",
|
||||||
"support.wallet.subscription.mode.Month": "按月",
|
"support.wallet.subscription.mode.Month": "按月",
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ import { useRouter } from 'next/router';
|
|||||||
import { useState, useEffect, useMemo } from 'react';
|
import { useState, useEffect, useMemo } from 'react';
|
||||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||||
import { useUserStore } from '@/web/support/user/useUserStore';
|
import { useUserStore } from '@/web/support/user/useUserStore';
|
||||||
import { StandardSubLevelEnum } from '@fastgpt/global/support/wallet/sub/constants';
|
|
||||||
import { useTranslation } from 'next-i18next';
|
import { useTranslation } from 'next-i18next';
|
||||||
import { getWorkorderURL } from '@/web/common/workorder/api';
|
import { getWorkorderURL } from '@/web/common/workorder/api';
|
||||||
|
import { TeamErrEnum } from '@fastgpt/global/common/error/code/team';
|
||||||
|
|
||||||
const BotShowRouter: { [key: string]: boolean } = {
|
const BotShowRouter: { [key: string]: boolean } = {
|
||||||
'/dashboard/agent': true,
|
'/dashboard/agent': true,
|
||||||
@@ -28,21 +28,14 @@ const HelperBot = () => {
|
|||||||
const [showChat, setShowChat] = useToggle(false);
|
const [showChat, setShowChat] = useToggle(false);
|
||||||
const [isLoading, setIsLoading] = useState(true);
|
const [isLoading, setIsLoading] = useState(true);
|
||||||
|
|
||||||
const { feConfigs, subPlans } = useSystemStore();
|
const { feConfigs, setNotSufficientModalType } = useSystemStore();
|
||||||
const { teamPlanStatus } = useUserStore();
|
const { teamPlanStatus } = useUserStore();
|
||||||
const isPlanUser = useMemo(() => {
|
|
||||||
if (!teamPlanStatus) return false;
|
|
||||||
if (teamPlanStatus.standard?.currentSubLevel !== StandardSubLevelEnum.free) return true;
|
|
||||||
if (teamPlanStatus.datasetMaxSize !== subPlans?.standard?.free?.maxDatasetSize) return true;
|
|
||||||
if (teamPlanStatus.totalPoints !== subPlans?.standard?.free?.totalPoints) return true;
|
|
||||||
return false;
|
|
||||||
}, [
|
|
||||||
subPlans?.standard?.free?.maxDatasetSize,
|
|
||||||
subPlans?.standard?.free?.totalPoints,
|
|
||||||
teamPlanStatus
|
|
||||||
]);
|
|
||||||
|
|
||||||
const showWorkorder = feConfigs?.show_workorder && isPlanUser;
|
const hasTicketAccess = useMemo(() => {
|
||||||
|
const ticketResponseTime = teamPlanStatus?.standard?.ticketResponseTime;
|
||||||
|
return ticketResponseTime !== undefined && ticketResponseTime > 0;
|
||||||
|
}, [teamPlanStatus?.standard?.ticketResponseTime]);
|
||||||
|
|
||||||
const botIframeUrl = feConfigs?.botIframeUrl;
|
const botIframeUrl = feConfigs?.botIframeUrl;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -54,6 +47,11 @@ const HelperBot = () => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const handleMessage = async (event: MessageEvent) => {
|
const handleMessage = async (event: MessageEvent) => {
|
||||||
if (event.data?.type === 'workorderRequest') {
|
if (event.data?.type === 'workorderRequest') {
|
||||||
|
if (!hasTicketAccess) {
|
||||||
|
setNotSufficientModalType(TeamErrEnum.ticketNotAvailable);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const data = await getWorkorderURL();
|
const data = await getWorkorderURL();
|
||||||
if (data?.redirectUrl) {
|
if (data?.redirectUrl) {
|
||||||
@@ -67,7 +65,7 @@ const HelperBot = () => {
|
|||||||
|
|
||||||
window.addEventListener('message', handleMessage);
|
window.addEventListener('message', handleMessage);
|
||||||
return () => window.removeEventListener('message', handleMessage);
|
return () => window.removeEventListener('message', handleMessage);
|
||||||
}, []);
|
}, [hasTicketAccess, setNotSufficientModalType]);
|
||||||
|
|
||||||
if (!botIframeUrl || !BotShowRouter[router.pathname]) {
|
if (!botIframeUrl || !BotShowRouter[router.pathname]) {
|
||||||
return null;
|
return null;
|
||||||
@@ -122,7 +120,7 @@ const HelperBot = () => {
|
|||||||
{/* iframe */}
|
{/* iframe */}
|
||||||
<Box
|
<Box
|
||||||
as="iframe"
|
as="iframe"
|
||||||
src={`${botIframeUrl}&showWorkorder=${showWorkorder ? '1' : '0'}`}
|
src={`${botIframeUrl}&showWorkorder=1`}
|
||||||
w={'100%'}
|
w={'100%'}
|
||||||
h={'100%'}
|
h={'100%'}
|
||||||
border={'none'}
|
border={'none'}
|
||||||
|
|||||||
@@ -33,7 +33,8 @@ const NotSufficientModal = () => {
|
|||||||
[TeamErrEnum.appAmountNotEnough]: t('common:support.wallet.App_amount_not_sufficient'),
|
[TeamErrEnum.appAmountNotEnough]: t('common:support.wallet.App_amount_not_sufficient'),
|
||||||
[TeamErrEnum.pluginAmountNotEnough]: t('common:support.wallet.App_amount_not_sufficient'),
|
[TeamErrEnum.pluginAmountNotEnough]: t('common:support.wallet.App_amount_not_sufficient'),
|
||||||
[TeamErrEnum.websiteSyncNotEnough]: t('common:code_error.team_error.website_sync_not_enough'),
|
[TeamErrEnum.websiteSyncNotEnough]: t('common:code_error.team_error.website_sync_not_enough'),
|
||||||
[TeamErrEnum.reRankNotEnough]: t('common:code_error.team_error.re_rank_not_enough')
|
[TeamErrEnum.reRankNotEnough]: t('common:code_error.team_error.re_rank_not_enough'),
|
||||||
|
[TeamErrEnum.ticketNotAvailable]: t('common:code_error.team_error.ticket_not_available')
|
||||||
};
|
};
|
||||||
|
|
||||||
return type ? (
|
return type ? (
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import { useTranslation } from 'next-i18next';
|
|||||||
import QuestionTip from '@fastgpt/web/components/common/MyTooltip/QuestionTip';
|
import QuestionTip from '@fastgpt/web/components/common/MyTooltip/QuestionTip';
|
||||||
import dynamic from 'next/dynamic';
|
import dynamic from 'next/dynamic';
|
||||||
import type { TeamSubSchema } from '@fastgpt/global/support/wallet/sub/type';
|
import type { TeamSubSchema } from '@fastgpt/global/support/wallet/sub/type';
|
||||||
|
import Markdown from '@/components/Markdown';
|
||||||
|
|
||||||
const ModelPriceModal = dynamic(() =>
|
const ModelPriceModal = dynamic(() =>
|
||||||
import('@/components/core/ai/ModelTable').then((mod) => mod.ModelPriceModal)
|
import('@/components/core/ai/ModelTable').then((mod) => mod.ModelPriceModal)
|
||||||
@@ -157,16 +158,26 @@ const StandardPlanContentList = ({
|
|||||||
</Box>
|
</Box>
|
||||||
</Flex>
|
</Flex>
|
||||||
)}
|
)}
|
||||||
{!!planContent.ticketResponseTime && (
|
<Flex alignItems={'center'}>
|
||||||
<Flex alignItems={'center'}>
|
<MyIcon name={'price/right'} w={'16px'} mr={3} />
|
||||||
<MyIcon name={'price/right'} w={'16px'} mr={3} />
|
<Box color={'myGray.600'}>
|
||||||
<Box color={'myGray.600'}>
|
{planContent.ticketResponseTime
|
||||||
{t('common:support.wallet.subscription.function.Ticket response time', {
|
? t('common:support.wallet.subscription.function.Ticket response time', {
|
||||||
amount: planContent.ticketResponseTime
|
amount: planContent.ticketResponseTime
|
||||||
})}
|
})
|
||||||
</Box>
|
: t('common:support.wallet.subscription.function.Community free support')}
|
||||||
</Flex>
|
</Box>
|
||||||
)}
|
{!planContent.ticketResponseTime && subPlans?.communitySupportTip && (
|
||||||
|
<QuestionTip
|
||||||
|
ml={1}
|
||||||
|
label={
|
||||||
|
<Box maxW="300px">
|
||||||
|
<Markdown source={subPlans.communitySupportTip} />
|
||||||
|
</Box>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</Flex>
|
||||||
{!!planContent.appRegistrationCount && (
|
{!!planContent.appRegistrationCount && (
|
||||||
<Flex alignItems={'center'}>
|
<Flex alignItems={'center'}>
|
||||||
<MyIcon name={'price/right'} w={'16px'} mr={3} />
|
<MyIcon name={'price/right'} w={'16px'} mr={3} />
|
||||||
|
|||||||
@@ -29,7 +29,8 @@ export type NotSufficientModalType =
|
|||||||
| TeamErrEnum.aiPointsNotEnough
|
| TeamErrEnum.aiPointsNotEnough
|
||||||
| TeamErrEnum.datasetAmountNotEnough
|
| TeamErrEnum.datasetAmountNotEnough
|
||||||
| TeamErrEnum.teamMemberOverSize
|
| TeamErrEnum.teamMemberOverSize
|
||||||
| TeamErrEnum.appAmountNotEnough;
|
| TeamErrEnum.appAmountNotEnough
|
||||||
|
| TeamErrEnum.ticketNotAvailable;
|
||||||
|
|
||||||
type State = {
|
type State = {
|
||||||
initd: boolean;
|
initd: boolean;
|
||||||
|
|||||||
Reference in New Issue
Block a user