feat: usage filter & export & dashbord (#3538)

* feat: usage filter & export & dashbord

* adjust ui

* fix tmb scroll

* fix code & selecte all

* merge
This commit is contained in:
heheer
2025-01-23 10:54:30 +08:00
committed by archer
parent 12c6ecb987
commit e4b85ffada
22 changed files with 1112 additions and 275 deletions

View File

@@ -6,6 +6,23 @@ export type CreateTrainingUsageProps = {
datasetId: string;
};
export type GetTotalPointsProps = {
dateStart: Date;
dateEnd: Date;
teamMemberIds: string[];
sources: UsageSourceEnum[];
unit: 'day' | 'week' | 'month';
};
export type GetUsageProps = {
dateStart: Date;
dateEnd: Date;
sources?: UsageSourceEnum[];
teamMemberIds?: string[];
projectName?: string;
isSelectAllTmb?: boolean;
};
export type ConcatUsageProps = UsageListItemCountType & {
teamId: string;
tmbId: string;

View File

@@ -18,30 +18,30 @@ export const UsageSourceMap = {
label: i18nT('common:core.chat.logs.online')
},
[UsageSourceEnum.api]: {
label: 'Api'
label: 'API'
},
[UsageSourceEnum.shareLink]: {
label: i18nT('common:core.chat.logs.free_login')
},
[UsageSourceEnum.training]: {
label: 'dataset.Training Name'
label: i18nT('common:dataset.Training Name')
},
[UsageSourceEnum.cronJob]: {
label: i18nT('common:cron_job_run_app')
},
[UsageSourceEnum.feishu]: {
label: i18nT('user:usage.feishu')
label: i18nT('account_usage:feishu')
},
[UsageSourceEnum.official_account]: {
label: i18nT('user:usage.official_account')
label: i18nT('account_usage:official_account')
},
[UsageSourceEnum.share]: {
label: i18nT('user:usage.share')
label: i18nT('account_usage:share')
},
[UsageSourceEnum.wecom]: {
label: i18nT('user:usage.wecom')
label: i18nT('account_usage:wecom')
},
[UsageSourceEnum.dingtalk]: {
label: i18nT('user:usage.dingtalk')
label: i18nT('account_usage:dingtalk')
}
};

View File

@@ -1,3 +1,4 @@
import { SourceMemberType } from '../../../support/user/type';
import { CreateUsageProps } from './api';
import { UsageSourceEnum } from './constants';
@@ -10,6 +11,7 @@ export type UsageListItemCountType = {
// deprecated
tokens?: number;
};
export type UsageListItemType = UsageListItemCountType & {
moduleName: string;
amount: number;
@@ -28,4 +30,5 @@ export type UsageItemType = {
source: UsageSchemaType['source'];
totalPoints: number;
list: UsageSchemaType['list'];
sourceMember: SourceMemberType;
};