Skip to content

Commit 8ad9e15

Browse files
authored
free plan workorder entrance (#6085)
1 parent b22ba1a commit 8ad9e15

File tree

9 files changed

+56
-28
lines changed

9 files changed

+56
-28
lines changed

packages/global/common/error/code/team.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export enum TeamErrEnum {
1414
appFolderAmountNotEnough = 'appFolderAmountNotEnough',
1515
websiteSyncNotEnough = 'websiteSyncNotEnough',
1616
reRankNotEnough = 'reRankNotEnough',
17+
ticketNotAvailable = 'ticketNotAvailable',
1718
groupNameEmpty = 'groupNameEmpty',
1819
groupNameDuplicate = 'groupNameDuplicate',
1920
groupNotExist = 'groupNotExist',
@@ -78,6 +79,10 @@ const teamErr = [
7879
statusText: TeamErrEnum.reRankNotEnough,
7980
message: i18nT('common:code_error.team_error.re_rank_not_enough')
8081
},
82+
{
83+
statusText: TeamErrEnum.ticketNotAvailable,
84+
message: i18nT('common:code_error.team_error.ticket_not_available')
85+
},
8186
{
8287
statusText: TeamErrEnum.groupNameEmpty,
8388
message: i18nT('common:code_error.team_error.group_name_empty')

packages/global/support/wallet/sub/type.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export type SubPlanType = {
4343
[SubTypeEnum.standard]?: StandSubPlanLevelMapType;
4444
planDescriptionUrl?: string;
4545
appRegistrationUrl?: string;
46+
communitySupportTip?: string;
4647
[SubTypeEnum.extraDatasetSize]: {
4748
price: number;
4849
};

packages/web/i18n/en/common.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@
195195
"code_error.team_error.over_size": "Team members exceed limit",
196196
"code_error.team_error.plugin_amount_not_enough": "Plugin Limit Reached",
197197
"code_error.team_error.re_rank_not_enough": "Search rearrangement cannot be used in the free version~",
198+
"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 ~",
198199
"code_error.team_error.too_many_invitations": "You have reached the maximum number of active invitation links, please clean up some links first",
199200
"code_error.team_error.un_auth": "Unauthorized to Operate This Team",
200201
"code_error.team_error.user_not_active": "The user did not accept or has left the team",
@@ -1224,6 +1225,9 @@
12241225
"support.wallet.subscription.function.Max members": "{{amount}} Member",
12251226
"support.wallet.subscription.function.Points": "{{amount}} points",
12261227
"support.wallet.subscription.function.Requests per minute": "{{amount}} QPM",
1228+
"support.wallet.subscription.function.Ticket response time": "{{amount}} hours ticket support response",
1229+
"support.wallet.subscription.function.Community free support": "Community free support",
1230+
"support.wallet.subscription.function.Community support tip": "Visit the FastGPT community for free help and technical support",
12271231
"support.wallet.subscription.function.Website sync per dataset": "Single knowledge base {{amount}} web pages synchronized",
12281232
"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",
12291233
"support.wallet.subscription.mode.Month": "Month",

packages/web/i18n/zh-CN/common.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@
196196
"code_error.team_error.over_size": "团队成员超出限制",
197197
"code_error.team_error.plugin_amount_not_enough": "插件数量已达上限~",
198198
"code_error.team_error.re_rank_not_enough": "免费版无法使用检索重排~",
199+
"code_error.team_error.ticket_not_available": "当前套餐暂不支持工单服务,可以前往社区免费获取帮助~",
199200
"code_error.team_error.too_many_invitations": "您的有效邀请链接数已达上限,请先清理链接",
200201
"code_error.team_error.un_auth": "无权操作该团队",
201202
"code_error.team_error.user_not_active": "用户未接受或已离开团队",
@@ -1234,6 +1235,8 @@
12341235
"support.wallet.subscription.function.Points": "{{amount}} 积分",
12351236
"support.wallet.subscription.function.Requests per minute": "{{amount}} QPM",
12361237
"support.wallet.subscription.function.Ticket response time": "{{amount}} 小时工单支持响应",
1238+
"support.wallet.subscription.function.Community free support": "社区免费支持",
1239+
"support.wallet.subscription.function.Community support tip": "可前往 FastGPT 社区免费获取帮助和技术支持",
12371240
"support.wallet.subscription.function.Website sync per dataset": "站点同步最大 {{amount}} 页",
12381241
"support.wallet.subscription.function.custom domain tip": "团队可以配置的自定义域名数量,目前可用于接入企微智能机器人",
12391242
"support.wallet.subscription.function.qpm tip": "主要指团队每分钟请求 Agent 的最大次数,与单个 Agent 复杂度无关。其他 OpenAPI 接口也受此影响,每个接口单独计算",

packages/web/i18n/zh-Hant/common.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@
195195
"code_error.team_error.over_size": "團隊成員超出限制",
196196
"code_error.team_error.plugin_amount_not_enough": "已達外掛程式數量上限",
197197
"code_error.team_error.re_rank_not_enough": "免費版無法使用檢索重排~",
198+
"code_error.team_error.ticket_not_available": "當前套餐暫不支持工單服務,可以前往社區免費獲取幫助~",
198199
"code_error.team_error.too_many_invitations": "您的有效邀請連結數已達上限,請先清理連結",
199200
"code_error.team_error.un_auth": "無權操作此團隊",
200201
"code_error.team_error.user_not_active": "使用者未接受或已離開團隊",
@@ -1221,6 +1222,9 @@
12211222
"support.wallet.subscription.function.Max members": "{{amount}} 個團隊成員",
12221223
"support.wallet.subscription.function.Points": "{{amount}} 積分",
12231224
"support.wallet.subscription.function.Requests per minute": "{{amount}} QPM",
1225+
"support.wallet.subscription.function.Ticket response time": "{{amount}} 小時工單支持響應",
1226+
"support.wallet.subscription.function.Community free support": "社群免費支持",
1227+
"support.wallet.subscription.function.Community support tip": "可前往 FastGPT 社群免費獲取幫助和技術支持",
12241228
"support.wallet.subscription.function.Website sync per dataset": "單知識庫 {{amount}} 個網頁同步",
12251229
"support.wallet.subscription.function.custom domain tip": "團隊可以配置的自定義域名數量,目前可用於接入企微智能機器人",
12261230
"support.wallet.subscription.mode.Month": "按月",

projects/app/src/components/Layout/HelperBot.tsx

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import { useRouter } from 'next/router';
66
import { useState, useEffect, useMemo } from 'react';
77
import { useSystemStore } from '@/web/common/system/useSystemStore';
88
import { useUserStore } from '@/web/support/user/useUserStore';
9-
import { StandardSubLevelEnum } from '@fastgpt/global/support/wallet/sub/constants';
109
import { useTranslation } from 'next-i18next';
1110
import { getWorkorderURL } from '@/web/common/workorder/api';
11+
import { TeamErrEnum } from '@fastgpt/global/common/error/code/team';
1212

1313
const BotShowRouter: { [key: string]: boolean } = {
1414
'/dashboard/agent': true,
@@ -28,21 +28,14 @@ const HelperBot = () => {
2828
const [showChat, setShowChat] = useToggle(false);
2929
const [isLoading, setIsLoading] = useState(true);
3030

31-
const { feConfigs, subPlans } = useSystemStore();
31+
const { feConfigs, setNotSufficientModalType } = useSystemStore();
3232
const { teamPlanStatus } = useUserStore();
33-
const isPlanUser = useMemo(() => {
34-
if (!teamPlanStatus) return false;
35-
if (teamPlanStatus.standard?.currentSubLevel !== StandardSubLevelEnum.free) return true;
36-
if (teamPlanStatus.datasetMaxSize !== subPlans?.standard?.free?.maxDatasetSize) return true;
37-
if (teamPlanStatus.totalPoints !== subPlans?.standard?.free?.totalPoints) return true;
38-
return false;
39-
}, [
40-
subPlans?.standard?.free?.maxDatasetSize,
41-
subPlans?.standard?.free?.totalPoints,
42-
teamPlanStatus
43-
]);
4433

45-
const showWorkorder = feConfigs?.show_workorder && isPlanUser;
34+
const hasTicketAccess = useMemo(() => {
35+
const ticketResponseTime = teamPlanStatus?.standard?.ticketResponseTime;
36+
return ticketResponseTime !== undefined && ticketResponseTime > 0;
37+
}, [teamPlanStatus?.standard?.ticketResponseTime]);
38+
4639
const botIframeUrl = feConfigs?.botIframeUrl;
4740

4841
useEffect(() => {
@@ -54,6 +47,11 @@ const HelperBot = () => {
5447
useEffect(() => {
5548
const handleMessage = async (event: MessageEvent) => {
5649
if (event.data?.type === 'workorderRequest') {
50+
if (!hasTicketAccess) {
51+
setNotSufficientModalType(TeamErrEnum.ticketNotAvailable);
52+
return;
53+
}
54+
5755
try {
5856
const data = await getWorkorderURL();
5957
if (data?.redirectUrl) {
@@ -67,7 +65,7 @@ const HelperBot = () => {
6765

6866
window.addEventListener('message', handleMessage);
6967
return () => window.removeEventListener('message', handleMessage);
70-
}, []);
68+
}, [hasTicketAccess, setNotSufficientModalType]);
7169

7270
if (!botIframeUrl || !BotShowRouter[router.pathname]) {
7371
return null;
@@ -122,7 +120,7 @@ const HelperBot = () => {
122120
{/* iframe */}
123121
<Box
124122
as="iframe"
125-
src={`${botIframeUrl}&showWorkorder=${showWorkorder ? '1' : '0'}`}
123+
src={`${botIframeUrl}&showWorkorder=1`}
126124
w={'100%'}
127125
h={'100%'}
128126
border={'none'}

projects/app/src/components/support/wallet/NotSufficientModal/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ const NotSufficientModal = () => {
3333
[TeamErrEnum.appAmountNotEnough]: t('common:support.wallet.App_amount_not_sufficient'),
3434
[TeamErrEnum.pluginAmountNotEnough]: t('common:support.wallet.App_amount_not_sufficient'),
3535
[TeamErrEnum.websiteSyncNotEnough]: t('common:code_error.team_error.website_sync_not_enough'),
36-
[TeamErrEnum.reRankNotEnough]: t('common:code_error.team_error.re_rank_not_enough')
36+
[TeamErrEnum.reRankNotEnough]: t('common:code_error.team_error.re_rank_not_enough'),
37+
[TeamErrEnum.ticketNotAvailable]: t('common:code_error.team_error.ticket_not_available')
3738
};
3839

3940
return type ? (

projects/app/src/components/support/wallet/StandardPlanContentList.tsx

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { useTranslation } from 'next-i18next';
99
import QuestionTip from '@fastgpt/web/components/common/MyTooltip/QuestionTip';
1010
import dynamic from 'next/dynamic';
1111
import type { TeamSubSchema } from '@fastgpt/global/support/wallet/sub/type';
12+
import Markdown from '@/components/Markdown';
1213

1314
const ModelPriceModal = dynamic(() =>
1415
import('@/components/core/ai/ModelTable').then((mod) => mod.ModelPriceModal)
@@ -157,16 +158,26 @@ const StandardPlanContentList = ({
157158
</Box>
158159
</Flex>
159160
)}
160-
{!!planContent.ticketResponseTime && (
161-
<Flex alignItems={'center'}>
162-
<MyIcon name={'price/right'} w={'16px'} mr={3} />
163-
<Box color={'myGray.600'}>
164-
{t('common:support.wallet.subscription.function.Ticket response time', {
165-
amount: planContent.ticketResponseTime
166-
})}
167-
</Box>
168-
</Flex>
169-
)}
161+
<Flex alignItems={'center'}>
162+
<MyIcon name={'price/right'} w={'16px'} mr={3} />
163+
<Box color={'myGray.600'}>
164+
{planContent.ticketResponseTime
165+
? t('common:support.wallet.subscription.function.Ticket response time', {
166+
amount: planContent.ticketResponseTime
167+
})
168+
: t('common:support.wallet.subscription.function.Community free support')}
169+
</Box>
170+
{!planContent.ticketResponseTime && subPlans?.communitySupportTip && (
171+
<QuestionTip
172+
ml={1}
173+
label={
174+
<Box maxW="300px">
175+
<Markdown source={subPlans.communitySupportTip} />
176+
</Box>
177+
}
178+
/>
179+
)}
180+
</Flex>
170181
{!!planContent.appRegistrationCount && (
171182
<Flex alignItems={'center'}>
172183
<MyIcon name={'price/right'} w={'16px'} mr={3} />

projects/app/src/web/common/system/useSystemStore.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ export type NotSufficientModalType =
2929
| TeamErrEnum.aiPointsNotEnough
3030
| TeamErrEnum.datasetAmountNotEnough
3131
| TeamErrEnum.teamMemberOverSize
32-
| TeamErrEnum.appAmountNotEnough;
32+
| TeamErrEnum.appAmountNotEnough
33+
| TeamErrEnum.ticketNotAvailable;
3334

3435
type State = {
3536
initd: boolean;

0 commit comments

Comments
 (0)