mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 21:13:50 +00:00
26
packages/global/support/wallet/usage/api.d.ts
vendored
26
packages/global/support/wallet/usage/api.d.ts
vendored
@@ -1,26 +0,0 @@
|
||||
import { UsageSourceEnum } from './constants';
|
||||
import { UsageListItemCountType, UsageListItemType } from './type';
|
||||
|
||||
export type CreateTrainingUsageProps = {
|
||||
name: string;
|
||||
datasetId: string;
|
||||
};
|
||||
|
||||
export type ConcatUsageProps = UsageListItemCountType & {
|
||||
teamId: string;
|
||||
tmbId: string;
|
||||
billId?: string;
|
||||
totalPoints: number;
|
||||
listIndex?: number;
|
||||
};
|
||||
|
||||
export type CreateUsageProps = {
|
||||
teamId: string;
|
||||
tmbId: string;
|
||||
appName: string;
|
||||
appId?: string;
|
||||
totalPoints: number;
|
||||
// inputTokens: number;
|
||||
source: `${UsageSourceEnum}`;
|
||||
list: UsageListItemType[];
|
||||
};
|
@@ -1,21 +0,0 @@
|
||||
export enum UsageSourceEnum {
|
||||
fastgpt = 'fastgpt',
|
||||
api = 'api',
|
||||
shareLink = 'shareLink',
|
||||
training = 'training'
|
||||
}
|
||||
|
||||
export const UsageSourceMap = {
|
||||
[UsageSourceEnum.fastgpt]: {
|
||||
label: '在线使用'
|
||||
},
|
||||
[UsageSourceEnum.api]: {
|
||||
label: 'Api'
|
||||
},
|
||||
[UsageSourceEnum.shareLink]: {
|
||||
label: '免登录链接'
|
||||
},
|
||||
[UsageSourceEnum.training]: {
|
||||
label: 'dataset.Training Name'
|
||||
}
|
||||
};
|
@@ -1,23 +0,0 @@
|
||||
/* bill common */
|
||||
import { PRICE_SCALE } from '../constants';
|
||||
import { UsageSourceEnum } from './constants';
|
||||
import { AuthUserTypeEnum } from '../../permission/constant';
|
||||
|
||||
/**
|
||||
* dataset price / PRICE_SCALE = real price
|
||||
*/
|
||||
export const formatStorePrice2Read = (val = 0, multiple = 1) => {
|
||||
return Number(((val / PRICE_SCALE) * multiple).toFixed(10));
|
||||
};
|
||||
|
||||
export const getUsageSourceByAuthType = ({
|
||||
shareId,
|
||||
authType
|
||||
}: {
|
||||
shareId?: string;
|
||||
authType?: `${AuthUserTypeEnum}`;
|
||||
}) => {
|
||||
if (shareId) return UsageSourceEnum.shareLink;
|
||||
if (authType === AuthUserTypeEnum.apikey) return UsageSourceEnum.api;
|
||||
return UsageSourceEnum.fastgpt;
|
||||
};
|
26
packages/global/support/wallet/usage/type.d.ts
vendored
26
packages/global/support/wallet/usage/type.d.ts
vendored
@@ -1,26 +0,0 @@
|
||||
import { CreateUsageProps } from './api';
|
||||
import { UsageSourceEnum } from './constants';
|
||||
|
||||
export type UsageListItemCountType = {
|
||||
charsLength?: number;
|
||||
duration?: number;
|
||||
};
|
||||
export type UsageListItemType = UsageListItemCountType & {
|
||||
moduleName: string;
|
||||
amount: number;
|
||||
model?: string;
|
||||
};
|
||||
|
||||
export type UsageSchemaType = CreateUsageProps & {
|
||||
_id: string;
|
||||
time: Date;
|
||||
};
|
||||
|
||||
export type UsageItemType = {
|
||||
id: string;
|
||||
time: Date;
|
||||
appName: string;
|
||||
source: UsageSchemaType['source'];
|
||||
totalPoints: number;
|
||||
list: UsageSchemaType['list'];
|
||||
};
|
Reference in New Issue
Block a user