feat: 新增多token用量查看
This commit is contained in:
@@ -3,7 +3,6 @@ import { del, get, post, put } from '@/utils/request';
|
||||
|
||||
// 获取当前用户的模型列表
|
||||
export function getModelList() {
|
||||
// return get<GetSessionListVO[]>('/system/model/modelList');
|
||||
return get<GetSessionListVO[]>('/ai-chat/model').json();
|
||||
}
|
||||
// 申请ApiKey
|
||||
@@ -21,72 +20,36 @@ export function getRechargeLog() {
|
||||
}
|
||||
|
||||
// 查询用户近7天token消耗
|
||||
export function getLast7DaysTokenUsage() {
|
||||
return get<any>('/usage-statistics/last7Days-token-usage').json();
|
||||
// tokenId: 可选,传入则查询该token的用量,不传则查询全部
|
||||
export function getLast7DaysTokenUsage(tokenId?: string) {
|
||||
const url = tokenId
|
||||
? `/usage-statistics/last7Days-token-usage?tokenId=${tokenId}`
|
||||
: '/usage-statistics/last7Days-token-usage';
|
||||
return get<any>(url).json();
|
||||
}
|
||||
// 查询用户token消耗各模型占比
|
||||
export function getModelTokenUsage() {
|
||||
return get<any>('/usage-statistics/model-token-usage').json();
|
||||
// tokenId: 可选,传入则查询该token的用量,不传则查询全部
|
||||
export function getModelTokenUsage(tokenId?: string) {
|
||||
const url = tokenId
|
||||
? `/usage-statistics/model-token-usage?tokenId=${tokenId}`
|
||||
: '/usage-statistics/model-token-usage';
|
||||
return get<any>(url).json();
|
||||
}
|
||||
|
||||
// 以下为新增接口
|
||||
|
||||
// 获取当前用户得token列表
|
||||
export function getTokenList() {
|
||||
return get<any>('/token/list').json();
|
||||
}
|
||||
/*
|
||||
返回数据:
|
||||
[
|
||||
{
|
||||
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
|
||||
"name": "string",
|
||||
"apiKey": "string",
|
||||
"expireTime": "2025-11-29T07:34:23.850Z",
|
||||
"premiumQuotaLimit": 0,
|
||||
"premiumUsedQuota": 0,
|
||||
"isDisabled": true,
|
||||
"creationTime": "2025-11-29T07:34:23.850Z"
|
||||
}
|
||||
] */
|
||||
|
||||
// 创建token
|
||||
export function createToken(data: any) {
|
||||
return post<any>('/token', data).json();
|
||||
}
|
||||
/*
|
||||
data:
|
||||
{
|
||||
"name": "string",
|
||||
"expireTime": "2025-11-29T07:35:10.458Z",
|
||||
"premiumQuotaLimit": 0
|
||||
} */
|
||||
/*
|
||||
返回:
|
||||
{
|
||||
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
|
||||
"name": "string",
|
||||
"apiKey": "string",
|
||||
"expireTime": "2025-11-29T07:35:10.459Z",
|
||||
"premiumQuotaLimit": 0,
|
||||
"premiumUsedQuota": 0,
|
||||
"isDisabled": true,
|
||||
"creationTime": "2025-11-29T07:35:10.459Z"
|
||||
} */
|
||||
|
||||
// 编辑token
|
||||
export function editToken(data: any) {
|
||||
return put('/token', data).json();
|
||||
}
|
||||
/*
|
||||
data:
|
||||
{
|
||||
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
|
||||
"name": "string",
|
||||
"expireTime": "2025-11-29T07:36:49.589Z",
|
||||
"premiumQuotaLimit": 0
|
||||
}
|
||||
*/
|
||||
|
||||
// 删除token
|
||||
export function deleteToken(id: string) {
|
||||
@@ -102,3 +65,31 @@ export function enableToken(id: string) {
|
||||
export function disableToken(id: string) {
|
||||
return post(`/token/${id}/disable`).json();
|
||||
}
|
||||
|
||||
// 新增接口2
|
||||
// 获取可选择的token信息
|
||||
export function getSelectableTokenInfo() {
|
||||
return get<any>('/token/select-list').json();
|
||||
}
|
||||
/*
|
||||
返回数据
|
||||
[
|
||||
{
|
||||
"tokenId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
|
||||
"name": "string",
|
||||
"isDisabled": true
|
||||
}
|
||||
] */
|
||||
// 获取当前用户尊享包不同token用量占比(饼图)
|
||||
export function getPremiumPackageTokenUsage() {
|
||||
return get<any>('/usage-statistics/premium-token-usage/by-token').json();
|
||||
}
|
||||
/* 返回数据
|
||||
[
|
||||
{
|
||||
"tokenId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
|
||||
"tokenName": "string",
|
||||
"tokens": 0,
|
||||
"percentage": 0
|
||||
}
|
||||
] */
|
||||
|
||||
Reference in New Issue
Block a user