docs and embedding bill
This commit is contained in:
@@ -82,7 +82,8 @@ export async function generateVector(): Promise<any> {
|
||||
const vectors = await openaiEmbedding({
|
||||
input: dataItems.map((item) => item.q),
|
||||
userId,
|
||||
type: 'training'
|
||||
type: 'training',
|
||||
mustPay: true
|
||||
});
|
||||
|
||||
// 生成结果插入到 pg
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
import { connectToDatabase, Bill, User, ShareChat } from '../mongo';
|
||||
import { ChatModelMap, OpenAiChatEnum, ChatModelType, embeddingModel } from '@/constants/model';
|
||||
import {
|
||||
ChatModelMap,
|
||||
OpenAiChatEnum,
|
||||
ChatModelType,
|
||||
embeddingModel,
|
||||
embeddingPrice
|
||||
} from '@/constants/model';
|
||||
import { BillTypeEnum } from '@/constants/user';
|
||||
|
||||
export const pushChatBill = async ({
|
||||
@@ -145,11 +151,9 @@ export const pushGenerateVectorBill = async ({
|
||||
await connectToDatabase();
|
||||
|
||||
try {
|
||||
const unitPrice = 0.4;
|
||||
// 计算价格. 至少为1
|
||||
const price = 0;
|
||||
// let price = unitPrice * tokenLen;
|
||||
// price = price > 1 ? price : 1;
|
||||
let price = embeddingPrice * tokenLen;
|
||||
price = price > 1 ? price : 1;
|
||||
|
||||
// 插入 Bill 记录
|
||||
const res = await Bill.create({
|
||||
|
||||
@@ -28,7 +28,7 @@ const UserSchema = new Schema({
|
||||
balance: {
|
||||
// 平台余额,不可提现
|
||||
type: Number,
|
||||
default: 0.5 * PRICE_SCALE
|
||||
default: 2 * PRICE_SCALE
|
||||
},
|
||||
inviterId: {
|
||||
// 谁邀请注册的
|
||||
|
||||
Reference in New Issue
Block a user