mirror of
http://112.124.100.131/huang.ze/ebiz-dify-ai.git
synced 2025-12-10 03:16:51 +08:00
feat: show more usage info in billing page (#4808)
This commit is contained in:
@@ -86,11 +86,13 @@ export const defaultPlan = {
|
||||
buildApps: 1,
|
||||
teamMembers: 1,
|
||||
annotatedResponse: 1,
|
||||
documentsUploadQuota: 1,
|
||||
},
|
||||
total: {
|
||||
vectorSpace: 10,
|
||||
buildApps: 10,
|
||||
teamMembers: 1,
|
||||
annotatedResponse: 10,
|
||||
documentsUploadQuota: 50,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -7,7 +7,11 @@ import { Plan } from '../type'
|
||||
import VectorSpaceInfo from '../usage-info/vector-space-info'
|
||||
import AppsInfo from '../usage-info/apps-info'
|
||||
import UpgradeBtn from '../upgrade-btn'
|
||||
import { User01 } from '../../base/icons/src/vender/line/users'
|
||||
import { MessageFastPlus } from '../../base/icons/src/vender/line/communication'
|
||||
import { FileUpload } from '../../base/icons/src/vender/line/files'
|
||||
import { useProviderContext } from '@/context/provider-context'
|
||||
import UsageInfo from '@/app/components/billing/usage-info'
|
||||
|
||||
const typeStyle = {
|
||||
[Plan.sandbox]: {
|
||||
@@ -41,6 +45,11 @@ const PlanComp: FC<Props> = ({
|
||||
type,
|
||||
} = plan
|
||||
|
||||
const {
|
||||
usage,
|
||||
total,
|
||||
} = plan
|
||||
|
||||
const isInHeader = loc === 'header'
|
||||
|
||||
return (
|
||||
@@ -76,8 +85,30 @@ const PlanComp: FC<Props> = ({
|
||||
|
||||
{/* Plan detail */}
|
||||
<div className='rounded-xl bg-white px-6 py-3'>
|
||||
<VectorSpaceInfo className='py-3' />
|
||||
|
||||
<UsageInfo
|
||||
className='py-3'
|
||||
Icon={User01}
|
||||
name={t('billing.plansCommon.teamMembers')}
|
||||
usage={usage.teamMembers}
|
||||
total={total.teamMembers}
|
||||
/>
|
||||
<AppsInfo className='py-3' />
|
||||
<VectorSpaceInfo className='py-3' />
|
||||
<UsageInfo
|
||||
className='py-3'
|
||||
Icon={MessageFastPlus}
|
||||
name={t('billing.plansCommon.annotationQuota')}
|
||||
usage={usage.annotatedResponse}
|
||||
total={total.annotatedResponse}
|
||||
/>
|
||||
<UsageInfo
|
||||
className='py-3'
|
||||
Icon={FileUpload}
|
||||
name={t('billing.plansCommon.documentsUploadQuota')}
|
||||
usage={usage.documentsUploadQuota}
|
||||
total={total.documentsUploadQuota}
|
||||
/>
|
||||
{isInHeader && type === Plan.sandbox && (
|
||||
<UpgradeBtn
|
||||
className='flex-shrink-0 my-3'
|
||||
|
||||
@@ -28,7 +28,7 @@ export type PlanInfo = {
|
||||
annotatedResponse: number
|
||||
}
|
||||
|
||||
export type UsagePlanInfo = Pick<PlanInfo, 'vectorSpace' | 'buildApps' | 'teamMembers' | 'annotatedResponse'>
|
||||
export type UsagePlanInfo = Pick<PlanInfo, 'vectorSpace' | 'buildApps' | 'teamMembers' | 'annotatedResponse' | 'documentsUploadQuota'>
|
||||
|
||||
export enum DocumentProcessingPriority {
|
||||
standard = 'standard',
|
||||
@@ -59,6 +59,10 @@ export type CurrentPlanInfoBackend = {
|
||||
size: number
|
||||
limit: number // total. 0 means unlimited
|
||||
}
|
||||
documents_upload_quota: {
|
||||
size: number
|
||||
limit: number // total. 0 means unlimited
|
||||
}
|
||||
docs_processing: DocumentProcessingPriority
|
||||
can_replace_logo: boolean
|
||||
}
|
||||
|
||||
@@ -16,12 +16,14 @@ export const parseCurrentPlan = (data: CurrentPlanInfoBackend) => {
|
||||
buildApps: data.apps?.size || 0,
|
||||
teamMembers: data.members.size,
|
||||
annotatedResponse: data.annotation_quota_limit.size,
|
||||
documentsUploadQuota: data.documents_upload_quota.size,
|
||||
},
|
||||
total: {
|
||||
vectorSpace: parseLimit(data.vector_space.limit),
|
||||
buildApps: parseLimit(data.apps?.limit) || 0,
|
||||
teamMembers: parseLimit(data.members.limit),
|
||||
annotatedResponse: parseLimit(data.annotation_quota_limit.limit),
|
||||
documentsUploadQuota: parseLimit(data.documents_upload_quota.limit),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user