perf: save chat and del chat content;UI

This commit is contained in:
archer
2023-04-30 13:18:54 +08:00
parent c971adaabd
commit f109f1cf60
19 changed files with 100 additions and 95 deletions

View File

@@ -4,6 +4,7 @@ import { ChatItemType } from '@/types/chat';
import { connectToDatabase, Chat } from '@/service/mongo';
import { authModel } from '@/service/utils/auth';
import { authToken } from '@/service/utils/auth';
import mongoose from 'mongoose';
/* 聊天内容存存储 */
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
@@ -23,6 +24,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
await connectToDatabase();
const content = prompts.map((item) => ({
_id: new mongoose.Types.ObjectId(item._id),
obj: item.obj,
value: item.value
}));