perf: bill framwork

This commit is contained in:
archer
2023-05-21 13:07:40 +08:00
parent e45c1eb1e0
commit 98444fd04b
19 changed files with 68 additions and 78 deletions

View File

@@ -3,9 +3,11 @@ import {
ModelStatusEnum,
ModelNameEnum,
ModelVectorSearchModeEnum,
ChatModelType
ChatModelType,
EmbeddingModelType
} from '@/constants/model';
import type { DataType } from './data';
import { BillTypeEnum } from '@/constants/user';
export interface UserModelSchema {
_id: string;
@@ -89,7 +91,8 @@ export interface ChatPopulate extends ChatSchema {
export interface BillSchema {
_id: string;
userId: string;
type: 'chat' | 'splitData' | 'return';
type: `${BillTypeEnum}`;
modelName: ChatModelType | EmbeddingModelType;
chatId: string;
time: Date;
textLen: number;

8
src/types/user.d.ts vendored
View File

@@ -1,3 +1,4 @@
import type { BillSchema } from './mongoSchema';
export interface UserType {
_id: string;
username: string;
@@ -17,11 +18,10 @@ export interface UserUpdateParams {
export interface UserBillType {
id: string;
time: string;
type: 'chat' | 'splitData' | 'return';
time: Date;
modelName: BillSchema['modelName'];
type: BillSchema['type'];
textLen: number;
tokenLen: number;
userId: string;
chatId: string;
price: number;
}