This commit is contained in:
Archer
2023-12-31 14:12:51 +08:00
committed by GitHub
parent ccca0468da
commit 9ccfda47b7
270 changed files with 8182 additions and 1295 deletions

View File

@@ -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 = {

View File

@@ -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]: '知识库存储'
};

View File

@@ -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,

View File

@@ -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 & {