feat: 兼容claude格式

This commit is contained in:
chenchun
2026-01-05 15:54:14 +08:00
parent b4a97e8b09
commit 29c1768ded
11 changed files with 645 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
import { post } from '@/utils/request';
import type {
ProfitStatisticsInput,
ProfitStatisticsOutput,
TokenStatisticsInput,
TokenStatisticsOutput,
} from './types';
// 获取利润统计数据
export function getProfitStatistics(data: ProfitStatisticsInput) {
return post<ProfitStatisticsOutput>('/system-statistics/profit', data).json();
}
// 获取指定日期各模型Token统计
export function getTokenStatistics(data: TokenStatisticsInput) {
return post<TokenStatisticsOutput>('/system-statistics/token', data).json();
}

View File

@@ -0,0 +1,41 @@
// 利润统计输入
export interface ProfitStatisticsInput {
currentCost: number;
}
// 利润统计输出
export interface ProfitStatisticsOutput {
date: string;
totalUsedTokens: number;
totalUsedTokensInHundredMillion: number;
totalRemainingTokens: number;
totalRemainingTokensInHundredMillion: number;
currentCost: number;
costPerHundredMillion: number;
totalCost: number;
totalRevenue: number;
profitRate: number;
costAt200Price: number;
}
// Token统计输入
export interface TokenStatisticsInput {
date: string;
}
// 模型Token统计DTO
export interface ModelTokenStatisticsDto {
modelId: string;
modelName: string;
tokens: number;
tokensInWan: number;
count: number;
cost: number;
costPerHundredMillion: number;
}
// Token统计输出
export interface TokenStatisticsOutput {
date: string;
modelStatistics: ModelTokenStatisticsDto[];
}