Skip to content

Commit 44f9503

Browse files
authored
bill coupon detail (#6054)
* bill coupon detail * enum * fix
1 parent e979f69 commit 44f9503

File tree

9 files changed

+246
-80
lines changed

9 files changed

+246
-80
lines changed

packages/global/openapi/support/wallet/bill/api.ts

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,14 @@ import {
55
BillStatusEnum,
66
BillPayWayEnum
77
} from '../../../../support/wallet/bill/constants';
8-
import { StandardSubLevelEnum, SubModeEnum } from '../../../../support/wallet/sub/constants';
8+
import {
9+
StandardSubLevelEnum,
10+
SubModeEnum,
11+
SubTypeEnum
12+
} from '../../../../support/wallet/sub/constants';
913
import { PaginationSchema } from '../../../api';
1014
import { BillSchema } from '../../../../support/wallet/bill/type';
15+
import { CouponTypeEnum } from '../../../../support/wallet/sub/coupon/constants';
1116

1217
// Bill list
1318
export const BillListQuerySchema = PaginationSchema.safeExtend({
@@ -85,7 +90,23 @@ export type CheckPayResultResponseType = z.infer<typeof CheckPayResultResponseSc
8590

8691
// Bill detail
8792
export const BillDetailResponseSchema = BillSchema.safeExtend({
88-
couponName: z.string().optional()
93+
discountCouponName: z.string().optional(),
94+
couponDetail: z
95+
.object({
96+
key: z.string(),
97+
type: z.enum(CouponTypeEnum),
98+
subscriptions: z.array(
99+
z.object({
100+
type: z.enum(SubTypeEnum),
101+
durationDay: z.number(),
102+
totalPoints: z.number().optional(),
103+
level: z.enum(StandardSubLevelEnum).optional(),
104+
extraDatasetSize: z.number().optional(),
105+
customConfig: z.record(z.string(), z.any()).optional()
106+
})
107+
)
108+
})
109+
.optional()
89110
});
90111
export type BillDetailResponseType = z.infer<typeof BillDetailResponseSchema>;
91112

packages/global/support/wallet/sub/coupon/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
export const COUPON_PREFIX = 'coupon-';
2+
13
export enum CouponTypeEnum {
24
bank = 'bank',
35
activity = 'activity'

packages/service/support/wallet/sub/utils.ts

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -61,20 +61,20 @@ export const getTeamStandPlan = async ({ teamId }: { teamId: string }) => {
6161
standardConstants: standardConstants
6262
? {
6363
...standardConstants,
64-
maxTeamMember: standard?.maxTeamMember || standardConstants.maxTeamMember,
65-
maxAppAmount: standard?.maxApp || standardConstants.maxAppAmount,
66-
maxDatasetAmount: standard?.maxDataset || standardConstants.maxDatasetAmount,
67-
requestsPerMinute: standard?.requestsPerMinute || standardConstants.requestsPerMinute,
64+
maxTeamMember: standard?.maxTeamMember ?? standardConstants.maxTeamMember,
65+
maxAppAmount: standard?.maxApp ?? standardConstants.maxAppAmount,
66+
maxDatasetAmount: standard?.maxDataset ?? standardConstants.maxDatasetAmount,
67+
requestsPerMinute: standard?.requestsPerMinute ?? standardConstants.requestsPerMinute,
6868
chatHistoryStoreDuration:
69-
standard?.chatHistoryStoreDuration || standardConstants.chatHistoryStoreDuration,
70-
maxDatasetSize: standard?.maxDatasetSize || standardConstants.maxDatasetSize,
69+
standard?.chatHistoryStoreDuration ?? standardConstants.chatHistoryStoreDuration,
70+
maxDatasetSize: standard?.maxDatasetSize ?? standardConstants.maxDatasetSize,
7171
websiteSyncPerDataset:
72-
standard?.websiteSyncPerDataset || standardConstants.websiteSyncPerDataset,
72+
standard?.websiteSyncPerDataset ?? standardConstants.websiteSyncPerDataset,
7373
appRegistrationCount:
74-
standard?.appRegistrationCount || standardConstants.appRegistrationCount,
74+
standard?.appRegistrationCount ?? standardConstants.appRegistrationCount,
7575
auditLogStoreDuration:
76-
standard?.auditLogStoreDuration || standardConstants.auditLogStoreDuration,
77-
ticketResponseTime: standard?.ticketResponseTime || standardConstants.ticketResponseTime
76+
standard?.auditLogStoreDuration ?? standardConstants.auditLogStoreDuration,
77+
ticketResponseTime: standard?.ticketResponseTime ?? standardConstants.ticketResponseTime
7878
}
7979
: undefined
8080
};
@@ -176,8 +176,8 @@ export const getTeamPlanStatus = async ({
176176

177177
const standardMaxDatasetSize =
178178
standardPlan?.currentSubLevel && standardPlans
179-
? standardPlans[standardPlan.currentSubLevel]?.maxDatasetSize ||
180-
standardPlan?.maxDatasetSize ||
179+
? standardPlan?.maxDatasetSize ||
180+
standardPlans[standardPlan.currentSubLevel]?.maxDatasetSize ||
181181
Infinity
182182
: Infinity;
183183
const totalDatasetSize =
@@ -196,21 +196,21 @@ export const getTeamPlanStatus = async ({
196196
standardConstants: standardConstants
197197
? {
198198
...standardConstants,
199-
maxTeamMember: standardPlan?.maxTeamMember || standardConstants.maxTeamMember,
200-
maxAppAmount: standardPlan?.maxApp || standardConstants.maxAppAmount,
201-
maxDatasetAmount: standardPlan?.maxDataset || standardConstants.maxDatasetAmount,
202-
requestsPerMinute: standardPlan?.requestsPerMinute || standardConstants.requestsPerMinute,
199+
maxTeamMember: standardPlan?.maxTeamMember ?? standardConstants.maxTeamMember,
200+
maxAppAmount: standardPlan?.maxApp ?? standardConstants.maxAppAmount,
201+
maxDatasetAmount: standardPlan?.maxDataset ?? standardConstants.maxDatasetAmount,
202+
requestsPerMinute: standardPlan?.requestsPerMinute ?? standardConstants.requestsPerMinute,
203203
chatHistoryStoreDuration:
204-
standardPlan?.chatHistoryStoreDuration || standardConstants.chatHistoryStoreDuration,
205-
maxDatasetSize: standardPlan?.maxDatasetSize || standardConstants.maxDatasetSize,
204+
standardPlan?.chatHistoryStoreDuration ?? standardConstants.chatHistoryStoreDuration,
205+
maxDatasetSize: standardPlan?.maxDatasetSize ?? standardConstants.maxDatasetSize,
206206
websiteSyncPerDataset:
207207
standardPlan?.websiteSyncPerDataset || standardConstants.websiteSyncPerDataset,
208208
appRegistrationCount:
209-
standardPlan?.appRegistrationCount || standardConstants.appRegistrationCount,
209+
standardPlan?.appRegistrationCount ?? standardConstants.appRegistrationCount,
210210
auditLogStoreDuration:
211-
standardPlan?.auditLogStoreDuration || standardConstants.auditLogStoreDuration,
211+
standardPlan?.auditLogStoreDuration ?? standardConstants.auditLogStoreDuration,
212212
ticketResponseTime:
213-
standardPlan?.ticketResponseTime || standardConstants.ticketResponseTime
213+
standardPlan?.ticketResponseTime ?? standardConstants.ticketResponseTime
214214
}
215215
: undefined,
216216

packages/web/i18n/en/account.json

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,20 @@
9898
"subscription_period": "Subscription cycle",
9999
"subscription_package": "Subscription package",
100100
"subscription_mode_month": "Duration",
101-
"month": "moon",
101+
"month": "month",
102+
"coupon_included_packages": "Coupon packages",
103+
"day": "day",
102104
"extra_dataset_size": "Additional knowledge base capacity",
103-
"extra_ai_points": "AI points calculation standard"
105+
"extra_ai_points": "AI points calculation standard",
106+
"max_team_member": "Max team members",
107+
"max_app_amount": "Max app amount",
108+
"max_dataset_amount": "Max dataset amount",
109+
"requests_per_minute": "Requests per minute",
110+
"max_dataset_size": "Max dataset size",
111+
"chat_history_store_duration": "Chat history storage duration",
112+
"website_sync_per_dataset": "Website sync per dataset",
113+
"app_registration_count": "App registration count",
114+
"audit_log_store_duration": "Audit log storage duration",
115+
"ticket_response_time": "Ticket response time",
116+
"custom_config_details": "Custom configuration details"
104117
}

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

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,32 @@
33
"active_model": "可用模型",
44
"add_default_model": "添加预设模型",
55
"api_key": "API 密钥",
6+
"app_registration_count": "应用备案数",
7+
"audit_log_store_duration": "团队操作日志记录时长",
8+
"bill_detail": "账单详情",
69
"bills_and_invoices": "账单与发票",
710
"channel": "模型渠道",
11+
"chat_history_store_duration": "对话记录保留时长",
812
"config_model": "模型配置",
913
"confirm_logout": "确认退出登录?",
1014
"create_channel": "新增渠道",
1115
"create_model": "新增模型",
16+
"custom_config_details": "定制配置详情",
1217
"custom_model": "自定义模型",
18+
"day": "",
1319
"default_model": "预设模型",
1420
"default_model_config": "默认模型配置",
21+
"extra_ai_points": "额外 AI 积分",
22+
"extra_dataset_size": "额外知识库容量",
23+
"generation_time": "生成时间",
24+
"has_invoice": "是否已开票",
25+
"hour": "小时",
1526
"language": "语言与时区",
1627
"logout": "登出",
28+
"max_app_amount": "Agent 上限",
29+
"max_dataset_amount": "知识库上限",
30+
"max_dataset_size": "知识库索引上限",
31+
"max_team_member": "团队成员上限",
1732
"model.active": "启用",
1833
"model.alias": "别名",
1934
"model.alias_tip": "模型在系统中展示的名字,方便用户理解",
@@ -76,29 +91,27 @@
7691
"model.voices": "声音角色",
7792
"model.voices_tip": "通过一个数组配置多个,例如:\n[\n {\n \"label\": \"Alloy\",\n \"value\": \"alloy\"\n },\n {\n \"label\": \"Echo\",\n \"value\": \"echo\"\n }\n]",
7893
"model_provider": "模型提供商",
94+
"month": "",
95+
"no": "",
7996
"notifications": "通知",
97+
"order_number": "订单号",
98+
"order_type": "订单类型",
99+
"payment_method": "支付方式",
80100
"personal_information": "个人信息",
81101
"personalization": "个性化",
82102
"promotion_records": "促销记录",
103+
"requests_per_minute": "QPM",
83104
"reset_default": "恢复默认配置",
105+
"status": "状态",
106+
"subscription_mode_month": "时长",
107+
"subscription_package": "订阅套餐",
108+
"subscription_period": "订阅周期",
109+
"support_wallet_amount": "金额",
84110
"team": "团队管理",
85111
"third_party": "第三方账号",
112+
"ticket_response_time": "工单支持响应时间",
86113
"usage_records": "使用记录",
87-
"bill_detail": "账单详情",
88-
"order_number": "订单号",
89-
"generation_time": "生成时间",
90-
"order_type": "订单类型",
91-
"status": "状态",
92-
"payment_method": "支付方式",
93-
"support_wallet_amount": "金额",
94-
"yuan": "{{amount}}元",
95-
"has_invoice": "是否已开票",
114+
"website_sync_per_dataset": "站点同步最大页数",
96115
"yes": "",
97-
"no": "",
98-
"subscription_period": "订阅周期",
99-
"subscription_package": "订阅套餐",
100-
"subscription_mode_month": "时长",
101-
"month": "",
102-
"extra_dataset_size": "额外知识库容量",
103-
"extra_ai_points": "额外 AI 积分"
116+
"yuan": "{{amount}}元"
104117
}

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

Lines changed: 37 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,32 @@
33
"active_model": "可用模型",
44
"add_default_model": "新增預設模型",
55
"api_key": "API 金鑰",
6+
"app_registration_count": "應用備案數",
7+
"audit_log_store_duration": "團隊操作日誌記錄時長",
8+
"bill_detail": "帳單詳細資訊",
69
"bills_and_invoices": "帳單與發票",
710
"channel": "模型管道",
11+
"chat_history_store_duration": "對話記錄保留時長",
812
"config_model": "模型設定",
9-
"confirm_logout": "確認登出登入",
10-
"create_channel": "新增頻道",
13+
"confirm_logout": "確認登出",
14+
"create_channel": "新增管道",
1115
"create_model": "新增模型",
16+
"custom_config_details": "定制配置詳情",
1217
"custom_model": "自訂模型",
18+
"day": "",
1319
"default_model": "預設模型",
1420
"default_model_config": "預設模型設定",
21+
"extra_ai_points": "額外 AI 積分",
22+
"extra_dataset_size": "額外知識庫容量",
23+
"generation_time": "生成時間",
24+
"has_invoice": "是否已開票",
25+
"hour": "小時",
1526
"language": "語言與時區",
1627
"logout": "登出",
28+
"max_app_amount": "Agent 上限",
29+
"max_dataset_amount": "知識庫上限",
30+
"max_dataset_size": "知識庫索引上限",
31+
"max_team_member": "團隊成員上限",
1732
"model.active": "啟用",
1833
"model.alias": "別名",
1934
"model.alias_tip": "模型在系統中展示的名字,方便使用者理解",
@@ -47,9 +62,9 @@
4762
"model.max_quote": "知識庫最大引用",
4863
"model.max_temperature": "最大溫度",
4964
"model.model_id": "模型 ID",
50-
"model.model_id_tip": "模型的唯一標識,也就是實際請求到服務商 model 的值,需要與 OneAPI 頻道中的模型對應",
65+
"model.model_id_tip": "模型的唯一標識,也就是實際請求到服務商 model 的值,需要與 OneAPI 管道中的模型對應",
5166
"model.normalization": "歸一化處理",
52-
"model.normalization_tip": "如果 Embedding API 未對向量值進行歸一化,可以啟用該開關,系統會進行歸一化處理。\n\n未歸一化的 API,表現為向量檢索得分會大於 1。",
67+
"model.normalization_tip": "如果 Embedding API 未對向量值進行歸一化,可以啟用該開關,系統會進行歸一化處理。\n未歸一化的 API,表現為向量檢索得分會大於 1。",
5368
"model.output_price": "模型輸出價格",
5469
"model.output_price_tip": "語言模型輸出價格,如果設定了該項,則模型綜合價格會失效",
5570
"model.param_name": "參數名稱",
@@ -58,7 +73,7 @@
5873
"model.request_auth": "自訂請求 Key",
5974
"model.request_auth_tip": "向自訂請求地址發起請求時候,攜帶請求頭:Authorization: Bearer xxx 進行請求",
6075
"model.request_url": "自訂請求地址",
61-
"model.request_url_tip": "如果填寫該值,則會直接向該地址發起請求,不經過 OneAPI。\n需要遵循 OpenAI 的 API 格式,並填寫完整請求地址,例如:\n\nLLM: {{host}}/v1/chat/completions\n\nEmbedding: {{host}}/v1/embeddings\n\nSTT: {{host}}/v1/audio/transcriptions\n\nTTS: {{host}}/v1/audio/speech\n\nRerank: {{host}}/v1/rerank",
76+
"model.request_url_tip": "如果填寫該值,則會直接向該地址發起請求,不經過 OneAPI。需要遵循 OpenAI 的 API 格式,並填寫完整請求地址,例如:\nLLM: {{host}}/v1/chat/completions\nEmbedding: {{host}}/v1/embeddings\nSTT: {{host}}/v1/audio/transcriptions\nTTS: {{host}}/v1/audio/speech\nRerank: {{host}}/v1/rerank",
6277
"model.response_format": "響應格式",
6378
"model.show_stop_sign": "展示停止序列參數",
6479
"model.show_top_p": "展示 Top-p 參數",
@@ -74,31 +89,29 @@
7489
"model.vision_tag": "視覺",
7590
"model.vision_tip": "如果模型支援圖片識別,則開啟該開關。",
7691
"model.voices": "聲音角色",
77-
"model.voices_tip": "透過一個陣列設定多個,例如:\n\n[\n {\n \"label\": \"Alloy\",\n \"value\": \"alloy\"\n },\n {\n \"label\": \"Echo\",\n \"value\": \"echo\"\n }\n]",
92+
"model.voices_tip": "透過一個陣列設定多個,例如:\n[\n {\n \"label\": \"Alloy\",\n \"value\": \"alloy\"\n },\n {\n \"label\": \"Echo\",\n \"value\": \"echo\"\n }\n]",
7893
"model_provider": "模型提供者",
94+
"month": "",
95+
"no": "",
7996
"notifications": "通知",
97+
"order_number": "訂單編號",
98+
"order_type": "訂單類型",
99+
"payment_method": "支付方式",
80100
"personal_information": "個人資訊",
81101
"personalization": "個人化",
82102
"promotion_records": "促銷記錄",
103+
"requests_per_minute": "QPM",
83104
"reset_default": "恢復預設設定",
84-
"team": "團隊管理",
85-
"third_party": "第三方賬號",
86-
"usage_records": "使用記錄",
87-
"bill_detail": "帳單詳細資訊",
88-
"order_number": "訂單編號",
89-
"generation_time": "生成時間",
90-
"order_type": "訂單類型",
91105
"status": "狀態",
92-
"payment_method": "支付方式",
106+
"subscription_mode_month": "時長",
107+
"subscription_package": "訂閱套餐",
108+
"subscription_period": "訂閱週期",
93109
"support_wallet_amount": "金額",
94-
"yuan": "{{amount}}元",
95-
"has_invoice": "是否已開票",
110+
"team": "團隊管理",
111+
"third_party": "第三方帳號",
112+
"ticket_response_time": "工單支援響應時間",
113+
"usage_records": "使用記錄",
114+
"website_sync_per_dataset": "站點同步最大頁數",
96115
"yes": "",
97-
"no": "",
98-
"subscription_period": "訂閱週期",
99-
"subscription_package": "訂閱套餐",
100-
"subscription_mode_month": "時長",
101-
"month": "",
102-
"extra_dataset_size": "額外知識庫容量",
103-
"extra_ai_points": "AI 積分運算標準"
104-
}
116+
"yuan": "{{amount}}元"
117+
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ const Navbar = ({ unread }: { unread: number }) => {
123123
w={'100%'}
124124
userSelect={'none'}
125125
pb={2}
126-
bg={isDashboardPage ? 'white' : 'transparent'}
126+
bg={isDashboardPage ? 'myGray.50' : 'transparent'}
127127
>
128128
{/* logo */}
129129
<Box flex={'0 0 auto'} mb={3}>

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,18 @@ const StandardPlanContentList = ({
3535
level: level as `${StandardSubLevelEnum}`,
3636
...standardSubLevelMap[level as `${StandardSubLevelEnum}`],
3737
totalPoints:
38-
standplan?.totalPoints || plan.totalPoints * (mode === SubModeEnum.month ? 1 : 12),
39-
requestsPerMinute: standplan?.requestsPerMinute || plan.requestsPerMinute || 2000,
40-
maxTeamMember: standplan?.maxTeamMember || plan.maxTeamMember,
41-
maxAppAmount: standplan?.maxApp || plan.maxAppAmount,
42-
maxDatasetAmount: standplan?.maxDataset || plan.maxDatasetAmount,
43-
maxDatasetSize: standplan?.maxDatasetSize || plan.maxDatasetSize,
44-
websiteSyncPerDataset: standplan?.websiteSyncPerDataset || plan.websiteSyncPerDataset,
38+
standplan?.totalPoints ?? plan.totalPoints * (mode === SubModeEnum.month ? 1 : 12),
39+
requestsPerMinute: standplan?.requestsPerMinute ?? plan.requestsPerMinute,
40+
maxTeamMember: standplan?.maxTeamMember ?? plan.maxTeamMember,
41+
maxAppAmount: standplan?.maxApp ?? plan.maxAppAmount,
42+
maxDatasetAmount: standplan?.maxDataset ?? plan.maxDatasetAmount,
43+
maxDatasetSize: standplan?.maxDatasetSize ?? plan.maxDatasetSize,
44+
websiteSyncPerDataset: standplan?.websiteSyncPerDataset ?? plan.websiteSyncPerDataset,
4545
chatHistoryStoreDuration:
46-
standplan?.chatHistoryStoreDuration || plan.chatHistoryStoreDuration,
47-
auditLogStoreDuration: standplan?.auditLogStoreDuration || plan.auditLogStoreDuration,
48-
appRegistrationCount: standplan?.appRegistrationCount || plan.appRegistrationCount,
49-
ticketResponseTime: standplan?.ticketResponseTime || plan.ticketResponseTime
46+
standplan?.chatHistoryStoreDuration ?? plan.chatHistoryStoreDuration,
47+
auditLogStoreDuration: standplan?.auditLogStoreDuration ?? plan.auditLogStoreDuration,
48+
appRegistrationCount: standplan?.appRegistrationCount ?? plan.appRegistrationCount,
49+
ticketResponseTime: standplan?.ticketResponseTime ?? plan.ticketResponseTime
5050
};
5151
}, [
5252
subPlans?.standard,

0 commit comments

Comments
 (0)