feat: 更新用量查看信息
This commit is contained in:
committed by
lijunwen.gigoo
parent
e35982efa1
commit
7a335a3276
@ -32,10 +32,10 @@ export const ActivatePopover: FC<PropsWithChildren<ActivatePopoverProps>> = ({
|
||||
show = true,
|
||||
}) => {
|
||||
console.log('children');
|
||||
if (!show) {
|
||||
return null;
|
||||
}
|
||||
return (
|
||||
|
||||
return !show ? (
|
||||
children
|
||||
) : (
|
||||
<Popover
|
||||
content={
|
||||
<div>
|
||||
|
||||
@ -158,7 +158,7 @@ export interface SearchProductRequest {
|
||||
/** Is recommended */
|
||||
is_recommend?: boolean,
|
||||
/** Product type list, use this parameter first, then EntityType */
|
||||
entity_types?: product_common.ProductEntityType[],
|
||||
entity_types?: string,
|
||||
/** Plugin type */
|
||||
plugin_type?: product_common.PluginType,
|
||||
/** Product paid type */
|
||||
@ -196,7 +196,7 @@ export interface SearchSuggestRequest {
|
||||
page_num?: number,
|
||||
page_size?: number,
|
||||
/** Product type list, use this parameter first, then EntityType */
|
||||
entity_types?: product_common.ProductEntityType[],
|
||||
entity_types?: string,
|
||||
}
|
||||
export interface FavoriteProductResponse {
|
||||
code: number,
|
||||
@ -345,6 +345,8 @@ export enum PluginAuthMode {
|
||||
Configured = 2,
|
||||
/** Authorization is required, but the authorization configuration may be user-level and can be configured by the user himself */
|
||||
Supported = 3,
|
||||
/** the third-party of coze saas plugin needs to be installed in the saas before it can be used. */
|
||||
NeedInstalled = 9,
|
||||
}
|
||||
export interface PluginExtraInfo {
|
||||
tools?: PluginToolInfo[],
|
||||
@ -370,6 +372,7 @@ export interface PluginExtraInfo {
|
||||
plugin_type?: product_common.PluginType,
|
||||
/** for opencoze */
|
||||
auth_mode?: PluginAuthMode,
|
||||
jump_saas_url?: string,
|
||||
}
|
||||
export interface ToolParameter {
|
||||
name: string,
|
||||
@ -903,6 +906,14 @@ export interface ProductCallRateLimit {
|
||||
[key: string | number]: ProductCallRateLimit
|
||||
},
|
||||
}
|
||||
export interface UserInfo {
|
||||
/** User name */
|
||||
user_name?: string,
|
||||
/** User nickname */
|
||||
nick_name?: string,
|
||||
/** User avatar url */
|
||||
avatar_url?: string,
|
||||
}
|
||||
export interface GetProductCallInfoData {
|
||||
/** mcp configuration json string */
|
||||
mcp_json: string,
|
||||
@ -912,6 +923,10 @@ export interface GetProductCallInfoData {
|
||||
call_count_limit: ProductCallCountLimit,
|
||||
/** Plugin tool call rate limit */
|
||||
call_rate_limit: ProductCallRateLimit,
|
||||
/** User info */
|
||||
user_info: UserInfo,
|
||||
/** Enterprise revert time */
|
||||
revert_time?: string,
|
||||
}
|
||||
export interface GetProductCallInfoResponse {
|
||||
code: number,
|
||||
|
||||
@ -20,10 +20,11 @@ import { useState } from 'react';
|
||||
|
||||
import dayjs from 'dayjs';
|
||||
import { useRequest } from 'ahooks';
|
||||
import { Modal, Space, Tag } from '@coze-arch/coze-design';
|
||||
import { explore } from '@coze-studio/api-schema';
|
||||
import { I18n } from '@coze-arch/i18n';
|
||||
import { Modal, Space, Tag, Avatar } from '@coze-arch/coze-design';
|
||||
import { formatPercent } from '@coze-arch/bot-utils';
|
||||
import { ProductEntityType } from '@coze-arch/bot-api/product_api';
|
||||
import { ProductApi } from '@coze-arch/bot-api';
|
||||
import { UserLevel } from '@coze-arch/bot-api/trade';
|
||||
|
||||
import { formatNumber } from './format-number';
|
||||
|
||||
@ -31,14 +32,29 @@ interface UsageModalProps {
|
||||
entity_id?: string;
|
||||
}
|
||||
|
||||
const getLevel = (level?: UserLevel) => {
|
||||
switch (level) {
|
||||
case UserLevel.Free:
|
||||
return I18n.t('coze_sidebar_free_ver');
|
||||
case UserLevel.ProPersonal:
|
||||
return I18n.t('export_import_2_agent_flow_15');
|
||||
case UserLevel.Team:
|
||||
return I18n.t('export_import_2_agent_flow_16');
|
||||
case UserLevel.Enterprise:
|
||||
return I18n.t('export_import_2_agent_flow_17');
|
||||
default:
|
||||
return I18n.t('coze_sidebar_free_ver');
|
||||
}
|
||||
};
|
||||
|
||||
//账号付费插件调用量弹窗hook
|
||||
export const useUsageModal = ({ entity_id }: UsageModalProps) => {
|
||||
const [visible, setVisible] = useState(false);
|
||||
|
||||
const { data } = useRequest(
|
||||
async () =>
|
||||
await ProductApi.PublicGetProductCallInfo({
|
||||
entity_type: ProductEntityType.Plugin,
|
||||
await explore.PublicGetProductCallInfo({
|
||||
entity_type: explore.product_common.ProductEntityType.Plugin,
|
||||
entity_id,
|
||||
enterprise_id: '',
|
||||
}),
|
||||
@ -82,17 +98,23 @@ export const useUsageModal = ({ entity_id }: UsageModalProps) => {
|
||||
<div>
|
||||
<Space spacing={4} className="mb-[16px]">
|
||||
<span className="w-[110px] font-[500]">账号信息</span>
|
||||
<Tag color="primary" size="mini">
|
||||
{data?.data?.user_level}
|
||||
</Tag>
|
||||
<Avatar
|
||||
className="w-[18px] h-[18px]"
|
||||
src={data?.data?.user_info?.avatar_url}
|
||||
shape="circle"
|
||||
/>
|
||||
<span className="coz-fg-secondary font-[500]">
|
||||
{data?.data?.user_info?.nick_name}
|
||||
</span>
|
||||
<span className="coz-fg-secondary">
|
||||
{`@${data?.data?.user_info?.user_name}`}
|
||||
</span>
|
||||
</Space>
|
||||
</div>
|
||||
|
||||
<Space spacing={4} className="mb-[16px]">
|
||||
<span className="w-[110px] font-[500]">订阅版本</span>
|
||||
<Tag color="primary" size="mini">
|
||||
{data?.data?.user_level}
|
||||
</Tag>
|
||||
<Tag color="primary">{getLevel(data?.data?.user_level)}</Tag>
|
||||
</Space>
|
||||
|
||||
<div className="mb-[16px]">
|
||||
|
||||
Reference in New Issue
Block a user