Files
FastGPT/packages/service/support/wallet/bill/controller.ts
Archer c031e6dcc9 4.6.7-alpha commit (#743)
Co-authored-by: Archer <545436317@qq.com>
Co-authored-by: heheer <71265218+newfish-cmyk@users.noreply.github.com>
2024-01-19 11:17:28 +08:00

43 lines
823 B
TypeScript

import { BillSourceEnum } from '@fastgpt/global/support/wallet/bill/constants';
import { MongoBill } from './schema';
export const createTrainingBill = async ({
teamId,
tmbId,
appName,
billSource,
vectorModel,
agentModel
}: {
teamId: string;
tmbId: string;
appName: string;
billSource: `${BillSourceEnum}`;
vectorModel: string;
agentModel: string;
}) => {
const { _id } = await MongoBill.create({
teamId,
tmbId,
appName,
source: billSource,
list: [
{
moduleName: 'wallet.moduleName.index',
model: vectorModel,
charsLength: 0,
amount: 0
},
{
moduleName: 'wallet.moduleName.qa',
model: agentModel,
charsLength: 0,
amount: 0
}
],
total: 0
});
return { billId: String(_id) };
};