mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-16 16:30:15 +01:00
39 lines
685 B
JavaScript
39 lines
685 B
JavaScript
const mongoose = require('mongoose');
|
|
|
|
const transactionSchema = mongoose.Schema(
|
|
{
|
|
user: {
|
|
type: mongoose.Schema.Types.ObjectId,
|
|
ref: 'User',
|
|
index: true,
|
|
required: true,
|
|
},
|
|
conversationId: {
|
|
type: String,
|
|
ref: 'Conversation',
|
|
index: true,
|
|
},
|
|
tokenType: {
|
|
type: String,
|
|
enum: ['prompt', 'completion', 'credits'],
|
|
required: true,
|
|
},
|
|
model: {
|
|
type: String,
|
|
},
|
|
context: {
|
|
type: String,
|
|
},
|
|
valueKey: {
|
|
type: String,
|
|
},
|
|
rate: Number,
|
|
rawAmount: Number,
|
|
tokenValue: Number,
|
|
},
|
|
{
|
|
timestamps: true,
|
|
},
|
|
);
|
|
|
|
module.exports = transactionSchema;
|