perf: chat source

This commit is contained in:
archer
2023-07-26 16:15:21 +08:00
parent c06a9fb52b
commit bf2310cc29
2 changed files with 69 additions and 61 deletions

View File

@@ -3,6 +3,7 @@ import { jsonRes } from '@/service/response';
import { connectToDatabase, Chat } from '@/service/mongo';
import { authUser } from '@/service/utils/auth';
import type { ChatHistoryItemType } from '@/types/chat';
import { ChatSourceEnum } from '@/constants/chat';
/* 获取历史记录 */
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
@@ -15,6 +16,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
const data = await Chat.find(
{
userId,
source: ChatSourceEnum.online,
...(appId && { appId })
},
'chatId title top customTitle appId updateTime'