feat: share chat page

This commit is contained in:
archer
2023-05-14 21:37:26 +08:00
parent d3e7923040
commit d31bdf0ee0
23 changed files with 2047 additions and 65 deletions

View File

@@ -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,