mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 08:50:15 +01:00
🖥️ feat: Match STDOUT Logs with Debug File Logs (#1944)
* chore: improve token balance logging post-request * feat: match stdout logging with file debug logging when using DEBUG_CONSOLE
This commit is contained in:
parent
ef86b25dae
commit
b2ef75e009
4 changed files with 13 additions and 5 deletions
|
|
@ -36,11 +36,17 @@ transactionSchema.statics.create = async function (transactionData) {
|
|||
}
|
||||
|
||||
// Adjust the user's balance
|
||||
return await Balance.findOneAndUpdate(
|
||||
const updatedBalance = await Balance.findOneAndUpdate(
|
||||
{ user: transaction.user },
|
||||
{ $inc: { tokenCredits: transaction.tokenValue } },
|
||||
{ upsert: true, new: true },
|
||||
).lean();
|
||||
|
||||
return {
|
||||
user: transaction.user.toString(),
|
||||
[transaction.tokenType]: transaction.tokenValue,
|
||||
balance: updatedBalance.tokenCredits,
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = mongoose.model('Transaction', transactionSchema);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue