mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-14 02:55:54 +08:00
feat: team admin can pay billing (#2240)
This commit is contained in:
parent
9fd55157d6
commit
2fc0dcc10a
@ -11,23 +11,23 @@ import { useProviderContext } from '@/context/provider-context'
|
|||||||
|
|
||||||
const Billing: FC = () => {
|
const Billing: FC = () => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const { isCurrentWorkspaceOwner } = useAppContext()
|
const { isCurrentWorkspaceManager } = useAppContext()
|
||||||
const [billingUrl, setBillingUrl] = React.useState('')
|
const [billingUrl, setBillingUrl] = React.useState('')
|
||||||
const { enableBilling } = useProviderContext()
|
const { enableBilling } = useProviderContext()
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!enableBilling || !isCurrentWorkspaceOwner)
|
if (!enableBilling || !isCurrentWorkspaceManager)
|
||||||
return
|
return
|
||||||
(async () => {
|
(async () => {
|
||||||
const { url } = await fetchBillingUrl()
|
const { url } = await fetchBillingUrl()
|
||||||
setBillingUrl(url)
|
setBillingUrl(url)
|
||||||
})()
|
})()
|
||||||
}, [isCurrentWorkspaceOwner])
|
}, [isCurrentWorkspaceManager])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<PlanComp loc={'billing-page'} />
|
<PlanComp loc={'billing-page'} />
|
||||||
{enableBilling && isCurrentWorkspaceOwner && billingUrl && (
|
{enableBilling && isCurrentWorkspaceManager && billingUrl && (
|
||||||
<a className='mt-5 flex px-6 justify-between h-12 items-center bg-gray-50 rounded-xl cursor-pointer' href={billingUrl} target='_blank'>
|
<a className='mt-5 flex px-6 justify-between h-12 items-center bg-gray-50 rounded-xl cursor-pointer' href={billingUrl} target='_blank'>
|
||||||
<div className='flex items-center'>
|
<div className='flex items-center'>
|
||||||
<ReceiptList className='w-4 h-4 text-gray-700' />
|
<ReceiptList className='w-4 h-4 text-gray-700' />
|
||||||
|
@ -20,8 +20,8 @@ const Pricing: FC<Props> = ({
|
|||||||
}) => {
|
}) => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const { plan } = useProviderContext()
|
const { plan } = useProviderContext()
|
||||||
const { isCurrentWorkspaceOwner } = useAppContext()
|
const { isCurrentWorkspaceManager } = useAppContext()
|
||||||
const canPay = isCurrentWorkspaceOwner
|
const canPay = isCurrentWorkspaceManager
|
||||||
const [planRange, setPlanRange] = React.useState<PlanRange>(PlanRange.monthly)
|
const [planRange, setPlanRange] = React.useState<PlanRange>(PlanRange.monthly)
|
||||||
|
|
||||||
return createPortal(
|
return createPortal(
|
||||||
|
@ -132,6 +132,7 @@ export enum CurrentSystemQuotaTypeEnum {
|
|||||||
export enum QuotaUnitEnum {
|
export enum QuotaUnitEnum {
|
||||||
times = 'times',
|
times = 'times',
|
||||||
tokens = 'tokens',
|
tokens = 'tokens',
|
||||||
|
credits = 'credits',
|
||||||
}
|
}
|
||||||
|
|
||||||
export type QuotaConfiguration = {
|
export type QuotaConfiguration = {
|
||||||
|
@ -62,6 +62,9 @@ const QuotaPanel: FC<QuotaPanelProps> = ({
|
|||||||
{
|
{
|
||||||
currentQuota?.quota_unit === QuotaUnitEnum.times && t('common.modelProvider.callTimes')
|
currentQuota?.quota_unit === QuotaUnitEnum.times && t('common.modelProvider.callTimes')
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
currentQuota?.quota_unit === QuotaUnitEnum.credits && t('common.modelProvider.credits')
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ const translation = {
|
|||||||
save: 'Save ',
|
save: 'Save ',
|
||||||
free: 'Free',
|
free: 'Free',
|
||||||
currentPlan: 'Current Plan',
|
currentPlan: 'Current Plan',
|
||||||
contractOwner: 'Contact your workspace owner',
|
contractOwner: 'Contact team manager',
|
||||||
startForFree: 'Start for free',
|
startForFree: 'Start for free',
|
||||||
getStartedWith: 'Get started with ',
|
getStartedWith: 'Get started with ',
|
||||||
contactSales: 'Contact Sales',
|
contactSales: 'Contact Sales',
|
||||||
@ -68,7 +68,7 @@ const translation = {
|
|||||||
tooltip: 'Manual editing and annotation of responses provides customizable high-quality question-answering abilities for apps. (Applicable only in chat apps)',
|
tooltip: 'Manual editing and annotation of responses provides customizable high-quality question-answering abilities for apps. (Applicable only in chat apps)',
|
||||||
},
|
},
|
||||||
ragAPIRequestTooltip: 'Refers to the number of API calls invoking only the knowledge base processing capabilities of Dify.',
|
ragAPIRequestTooltip: 'Refers to the number of API calls invoking only the knowledge base processing capabilities of Dify.',
|
||||||
receiptInfo: 'Only team owner can subscribe and view billing information',
|
receiptInfo: 'Only team owner and team admin can subscribe and view billing information',
|
||||||
},
|
},
|
||||||
plans: {
|
plans: {
|
||||||
sandbox: {
|
sandbox: {
|
||||||
|
@ -20,7 +20,7 @@ const translation = {
|
|||||||
save: 'Save ',
|
save: 'Save ',
|
||||||
free: 'Free',
|
free: 'Free',
|
||||||
currentPlan: 'Current Plan',
|
currentPlan: 'Current Plan',
|
||||||
contractOwner: 'Contact your workspace owner',
|
contractOwner: 'Contact team manager',
|
||||||
startForFree: 'Start for free',
|
startForFree: 'Start for free',
|
||||||
getStartedWith: 'Get started with ',
|
getStartedWith: 'Get started with ',
|
||||||
contactSales: 'Contact Sales',
|
contactSales: 'Contact Sales',
|
||||||
@ -68,6 +68,7 @@ const translation = {
|
|||||||
tooltip: 'Manual editing and annotation of responses provides customizable high-quality question-answering abilities for apps. (Applicable only in chat apps)',
|
tooltip: 'Manual editing and annotation of responses provides customizable high-quality question-answering abilities for apps. (Applicable only in chat apps)',
|
||||||
},
|
},
|
||||||
ragAPIRequestTooltip: 'Refers to the number of API calls invoking only the knowledge base processing capabilities of Dify.',
|
ragAPIRequestTooltip: 'Refers to the number of API calls invoking only the knowledge base processing capabilities of Dify.',
|
||||||
|
receiptInfo: 'Somente proprietários e administradores de equipe podem se inscrever e visualizar informações de cobrança',
|
||||||
},
|
},
|
||||||
plans: {
|
plans: {
|
||||||
sandbox: {
|
sandbox: {
|
||||||
|
@ -19,7 +19,7 @@ const translation = {
|
|||||||
year: '年',
|
year: '年',
|
||||||
save: '节省',
|
save: '节省',
|
||||||
currentPlan: '当前计划',
|
currentPlan: '当前计划',
|
||||||
contractOwner: '联系您的工作区所有者',
|
contractOwner: '联系团队管理员',
|
||||||
free: '免费',
|
free: '免费',
|
||||||
startForFree: '免费开始',
|
startForFree: '免费开始',
|
||||||
getStartedWith: '开始使用',
|
getStartedWith: '开始使用',
|
||||||
@ -68,7 +68,7 @@ const translation = {
|
|||||||
tooltip: '标注回复功能通过人工编辑标注为应用提供了可定制的高质量问答回复能力',
|
tooltip: '标注回复功能通过人工编辑标注为应用提供了可定制的高质量问答回复能力',
|
||||||
},
|
},
|
||||||
ragAPIRequestTooltip: '指单独调用 Dify 知识库数据处理能力的 API。',
|
ragAPIRequestTooltip: '指单独调用 Dify 知识库数据处理能力的 API。',
|
||||||
receiptInfo: '只有团队所有者才能订阅和查看账单信息',
|
receiptInfo: '只有团队所有者和团队管理员才能订阅和查看账单信息',
|
||||||
},
|
},
|
||||||
plans: {
|
plans: {
|
||||||
sandbox: {
|
sandbox: {
|
||||||
|
@ -303,6 +303,7 @@ const translation = {
|
|||||||
model: 'Model',
|
model: 'Model',
|
||||||
featureSupported: '{{feature}} supported',
|
featureSupported: '{{feature}} supported',
|
||||||
callTimes: 'Call times',
|
callTimes: 'Call times',
|
||||||
|
credits: 'Message Credits',
|
||||||
buyQuota: 'Buy Quota',
|
buyQuota: 'Buy Quota',
|
||||||
getFreeTokens: 'Get free Tokens',
|
getFreeTokens: 'Get free Tokens',
|
||||||
priorityUsing: 'Prioritize using',
|
priorityUsing: 'Prioritize using',
|
||||||
|
@ -303,6 +303,7 @@ const translation = {
|
|||||||
model: '模型',
|
model: '模型',
|
||||||
featureSupported: '支持 {{feature}} 功能',
|
featureSupported: '支持 {{feature}} 功能',
|
||||||
callTimes: '调用次数',
|
callTimes: '调用次数',
|
||||||
|
credits: '消息额度',
|
||||||
buyQuota: '购买额度',
|
buyQuota: '购买额度',
|
||||||
getFreeTokens: '获得免费 Tokens',
|
getFreeTokens: '获得免费 Tokens',
|
||||||
priorityUsing: '优先使用',
|
priorityUsing: '优先使用',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user