perf: chat ui

This commit is contained in:
archer
2023-05-12 20:41:42 +08:00
parent 3e5118c4f7
commit 4e0c876154
10 changed files with 162 additions and 107 deletions

View File

@@ -13,7 +13,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
newChatId: '' | string;
chatId: '' | string;
modelId: string;
prompts: ChatItemType[];
prompts: [ChatItemType, ChatItemType];
};
if (!prompts) {
@@ -41,7 +41,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
modelId,
content,
title: content[0].value.slice(0, 20),
latestChat: content[content.length - 1].value
latestChat: content[1].value
});
return jsonRes(res, {
data: _id
@@ -54,8 +54,9 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
$each: content
}
},
updateTime: new Date(),
latestChat: content[content.length - 1].value
title: content[0].value.slice(0, 20),
latestChat: content[1].value,
updateTime: new Date()
});
}
jsonRes(res);