feat: share chat page
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { connectToDatabase, Bill, User } from '../mongo';
|
||||
import { connectToDatabase, Bill, User, ShareChat } from '../mongo';
|
||||
import { ChatModelMap, OpenAiChatEnum, ChatModelType, embeddingModel } from '@/constants/model';
|
||||
import { BillTypeEnum } from '@/constants/user';
|
||||
|
||||
@@ -55,6 +55,23 @@ export const pushChatBill = async ({
|
||||
}
|
||||
};
|
||||
|
||||
export const updateShareChatBill = async ({
|
||||
shareId,
|
||||
tokens
|
||||
}: {
|
||||
shareId: string;
|
||||
tokens: number;
|
||||
}) => {
|
||||
try {
|
||||
await ShareChat.findByIdAndUpdate(shareId, {
|
||||
$inc: { tokens },
|
||||
lastTime: new Date()
|
||||
});
|
||||
} catch (error) {
|
||||
console.log('update shareChat error', error);
|
||||
}
|
||||
};
|
||||
|
||||
export const pushSplitDataBill = async ({
|
||||
isPay,
|
||||
userId,
|
||||
|
||||
Reference in New Issue
Block a user