mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 05:12:39 +00:00
V4.6.6-2 (#673)
This commit is contained in:
1
packages/global/support/user/team/type.d.ts
vendored
1
packages/global/support/user/team/type.d.ts
vendored
@@ -9,6 +9,7 @@ export type TeamSchema = {
|
||||
createTime: Date;
|
||||
balance: number;
|
||||
maxSize: number;
|
||||
lastDatasetBillTime: Date;
|
||||
};
|
||||
|
||||
export type TeamMemberSchema = {
|
||||
|
5
packages/global/support/wallet/bill/api.d.ts
vendored
5
packages/global/support/wallet/bill/api.d.ts
vendored
@@ -1,5 +1,5 @@
|
||||
import { BillSourceEnum } from './constants';
|
||||
import { BillListItemType } from './type';
|
||||
import { BillListItemCountType, BillListItemType } from './type';
|
||||
|
||||
export type CreateTrainingBillProps = {
|
||||
name: string;
|
||||
@@ -7,13 +7,12 @@ export type CreateTrainingBillProps = {
|
||||
agentModel?: string;
|
||||
};
|
||||
|
||||
export type ConcatBillProps = {
|
||||
export type ConcatBillProps = BillListItemCountType & {
|
||||
teamId: string;
|
||||
tmbId: string;
|
||||
billId?: string;
|
||||
total: number;
|
||||
listIndex?: number;
|
||||
tokens?: number;
|
||||
};
|
||||
|
||||
export type CreateBillProps = {
|
||||
|
@@ -1,16 +1,19 @@
|
||||
// ¥1 = 100000
|
||||
// model price: xxx/1k tokens
|
||||
// ¥1 = 100000.
|
||||
export const PRICE_SCALE = 100000;
|
||||
|
||||
export enum BillSourceEnum {
|
||||
fastgpt = 'fastgpt',
|
||||
api = 'api',
|
||||
shareLink = 'shareLink',
|
||||
training = 'training'
|
||||
training = 'training',
|
||||
datasetStore = 'datasetStore'
|
||||
}
|
||||
|
||||
export const BillSourceMap: Record<`${BillSourceEnum}`, string> = {
|
||||
[BillSourceEnum.fastgpt]: '在线使用',
|
||||
[BillSourceEnum.api]: 'Api',
|
||||
[BillSourceEnum.shareLink]: '免登录链接',
|
||||
[BillSourceEnum.training]: '数据训练'
|
||||
[BillSourceEnum.training]: '数据训练',
|
||||
[BillSourceEnum.datasetStore]: '知识库存储'
|
||||
};
|
||||
|
@@ -6,9 +6,12 @@ import { AuthUserTypeEnum } from '../../permission/constant';
|
||||
/**
|
||||
* dataset price / PRICE_SCALE = real price
|
||||
*/
|
||||
export const formatPrice = (val = 0, multiple = 1) => {
|
||||
export const formatStorePrice2Read = (val = 0, multiple = 1) => {
|
||||
return Number(((val / PRICE_SCALE) * multiple).toFixed(10));
|
||||
};
|
||||
export const formatModelPrice2Read = (val = 0) => {
|
||||
return Number((val / 1000).toFixed(10));
|
||||
};
|
||||
|
||||
export const getBillSourceByAuthType = ({
|
||||
shareId,
|
||||
|
13
packages/global/support/wallet/bill/type.d.ts
vendored
13
packages/global/support/wallet/bill/type.d.ts
vendored
@@ -1,11 +1,20 @@
|
||||
import { CreateBillProps } from './api';
|
||||
import { BillSourceEnum } from './constants';
|
||||
|
||||
export type BillListItemType = {
|
||||
export type BillListItemCountType = {
|
||||
inputTokens?: number;
|
||||
outputTokens?: number;
|
||||
textLen?: number;
|
||||
duration?: number;
|
||||
dataLen?: number;
|
||||
|
||||
// abandon
|
||||
tokenLen?: number;
|
||||
};
|
||||
export type BillListItemType = BillListItemCountType & {
|
||||
moduleName: string;
|
||||
amount: number;
|
||||
model?: string;
|
||||
tokenLen?: number;
|
||||
};
|
||||
|
||||
export type BillSchema = CreateBillProps & {
|
||||
|
Reference in New Issue
Block a user