parent
4f5a12f33b
commit
02fcb6a61e
@ -13,6 +13,7 @@
|
||||
"every_month": "Moon",
|
||||
"export_confirm": "Export confirmation",
|
||||
"export_confirm_tip": "There are currently {{total}} usage records in total. Are you sure to export?",
|
||||
"export_title": "Time,Members,Type,Project name,AI points",
|
||||
"feishu": "Feishu",
|
||||
"generation_time": "Generation time",
|
||||
"input_token_length": "input tokens",
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
"export_confirm": "导出确认",
|
||||
"export_confirm_tip": "当前共 {{total}} 条使用记录,确认导出?",
|
||||
"export_success": "导出成功",
|
||||
"export_title": "时间,成员,类型,项目名,AI 积分消耗",
|
||||
"feishu": "飞书",
|
||||
"generation_time": "生成时间",
|
||||
"input_token_length": "输入 tokens",
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
"every_month": "月",
|
||||
"export_confirm": "導出確認",
|
||||
"export_confirm_tip": "當前共 {{total}} 筆使用記錄,確認導出?",
|
||||
"export_title": "時間,成員,類型,項目名,AI 積分消耗",
|
||||
"feishu": "飛書",
|
||||
"generation_time": "生成時間",
|
||||
"input_token_length": "輸入 tokens",
|
||||
|
||||
@ -43,24 +43,47 @@ const UsageTableList = ({
|
||||
|
||||
const { dateRange, selectTmbIds, isSelectAllTmb, usageSources, isSelectAllSource, projectName } =
|
||||
filterParams;
|
||||
const requestParans = useMemo(
|
||||
() => ({
|
||||
const requestParams = useMemo(() => {
|
||||
const appNameMap = {
|
||||
['core.app.Question Guide']: t('common:core.app.Question Guide'),
|
||||
['common:support.wallet.usage.Audio Speech']: t('common:support.wallet.usage.Audio Speech'),
|
||||
['support.wallet.usage.Whisper']: t('common:support.wallet.usage.Whisper'),
|
||||
['support.wallet.moduleName.index']: t('common:support.wallet.moduleName.index'),
|
||||
['support.wallet.moduleName.qa']: t('common:support.wallet.moduleName.qa'),
|
||||
['core.dataset.training.Auto mode']: t('common:core.dataset.training.Auto mode'),
|
||||
['common:core.module.template.ai_chat']: t('common:core.module.template.ai_chat')
|
||||
};
|
||||
|
||||
const sourcesMap = Object.fromEntries(
|
||||
Object.entries(UsageSourceMap).map(([key, config]) => [
|
||||
key,
|
||||
{
|
||||
label: t(config.label as any)
|
||||
}
|
||||
])
|
||||
);
|
||||
const title = t('account_usage:export_title');
|
||||
|
||||
return {
|
||||
dateStart: dateRange.from || new Date(),
|
||||
dateEnd: addDays(dateRange.to || new Date(), 1),
|
||||
sources: isSelectAllSource ? undefined : usageSources,
|
||||
sourcesMap,
|
||||
appNameMap,
|
||||
title,
|
||||
teamMemberIds: isSelectAllTmb ? undefined : selectTmbIds,
|
||||
projectName
|
||||
}),
|
||||
[
|
||||
dateRange.from,
|
||||
dateRange.to,
|
||||
isSelectAllSource,
|
||||
isSelectAllTmb,
|
||||
projectName,
|
||||
selectTmbIds,
|
||||
usageSources
|
||||
]
|
||||
);
|
||||
};
|
||||
}, [
|
||||
dateRange.from,
|
||||
dateRange.to,
|
||||
isSelectAllSource,
|
||||
isSelectAllTmb,
|
||||
projectName,
|
||||
selectTmbIds,
|
||||
usageSources,
|
||||
t
|
||||
]);
|
||||
|
||||
const {
|
||||
data: usages,
|
||||
@ -69,8 +92,8 @@ const UsageTableList = ({
|
||||
total
|
||||
} = usePagination(getUserUsages, {
|
||||
pageSize: 20,
|
||||
params: requestParans,
|
||||
refreshDeps: [requestParans]
|
||||
params: requestParams,
|
||||
refreshDeps: [requestParams]
|
||||
});
|
||||
|
||||
const [usageDetail, setUsageDetail] = useState<UsageItemType>();
|
||||
@ -80,11 +103,11 @@ const UsageTableList = ({
|
||||
await downloadFetch({
|
||||
url: `/api/proApi/support/wallet/usage/exportUsage`,
|
||||
filename: `usage.csv`,
|
||||
body: requestParans
|
||||
body: requestParams
|
||||
});
|
||||
},
|
||||
{
|
||||
refreshDeps: [requestParans]
|
||||
refreshDeps: [requestParams]
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user