mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 21:13:50 +00:00
V4.6.6-2 (#673)
This commit is contained in:
@@ -2,7 +2,7 @@ import { connectionMongo, type Model } from '../../common/mongo';
|
||||
const { Schema, model, models } = connectionMongo;
|
||||
import type { OpenApiSchema } from '@fastgpt/global/support/openapi/type';
|
||||
import { PRICE_SCALE } from '@fastgpt/global/support/wallet/bill/constants';
|
||||
import { formatPrice } from '@fastgpt/global/support/wallet/bill/tools';
|
||||
import { formatStorePrice2Read } from '@fastgpt/global/support/wallet/bill/tools';
|
||||
import {
|
||||
TeamCollectionName,
|
||||
TeamMemberCollectionName
|
||||
@@ -48,7 +48,7 @@ const OpenApiSchema = new Schema(
|
||||
// total usage. value from bill total
|
||||
type: Number,
|
||||
default: 0,
|
||||
get: (val: number) => formatPrice(val)
|
||||
get: (val: number) => formatStorePrice2Read(val)
|
||||
},
|
||||
limit: {
|
||||
expiredTime: {
|
||||
@@ -59,7 +59,7 @@ const OpenApiSchema = new Schema(
|
||||
type: Number,
|
||||
default: -1,
|
||||
set: (val: number) => val * PRICE_SCALE,
|
||||
get: (val: number) => formatPrice(val)
|
||||
get: (val: number) => formatStorePrice2Read(val)
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@@ -43,6 +43,7 @@ const TeamMemberSchema = new Schema({
|
||||
});
|
||||
|
||||
try {
|
||||
TeamMemberSchema.index({ teamId: 1 });
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
|
@@ -29,10 +29,14 @@ const TeamSchema = new Schema({
|
||||
maxSize: {
|
||||
type: Number,
|
||||
default: 5
|
||||
},
|
||||
lastDatasetBillTime: {
|
||||
type: Date
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
TeamSchema.index({ lastDatasetBillTime: -1 });
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
|
@@ -25,14 +25,16 @@ export const createTrainingBill = async ({
|
||||
{
|
||||
moduleName: 'wallet.moduleName.index',
|
||||
model: vectorModel,
|
||||
amount: 0,
|
||||
tokenLen: 0
|
||||
inputTokens: 0,
|
||||
outputTokens: 0,
|
||||
amount: 0
|
||||
},
|
||||
{
|
||||
moduleName: 'wallet.moduleName.qa',
|
||||
model: agentModel,
|
||||
amount: 0,
|
||||
tokenLen: 0
|
||||
inputTokens: 0,
|
||||
outputTokens: 0,
|
||||
amount: 0
|
||||
}
|
||||
],
|
||||
total: 0
|
||||
|
@@ -52,7 +52,8 @@ const BillSchema = new Schema({
|
||||
});
|
||||
|
||||
try {
|
||||
BillSchema.index({ userId: 1 });
|
||||
BillSchema.index({ teamId: 1 });
|
||||
BillSchema.index({ tmbId: 1 });
|
||||
BillSchema.index({ time: 1 }, { expireAfterSeconds: 90 * 24 * 60 * 60 });
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
|
Reference in New Issue
Block a user