feat: custom title and set history top
This commit is contained in:
@@ -77,15 +77,13 @@ export async function saveChat({
|
||||
});
|
||||
return _id;
|
||||
} else {
|
||||
// 已经有记录,追加入库
|
||||
const chat = await Chat.findById(chatId);
|
||||
await Chat.findByIdAndUpdate(chatId, {
|
||||
$push: {
|
||||
content: {
|
||||
$each: content
|
||||
}
|
||||
},
|
||||
...(chat && !chat.customTitle ? { title: content[0].value.slice(0, 20) } : {}),
|
||||
title: content[0].value.slice(0, 20),
|
||||
latestChat: content[1].value,
|
||||
updateTime: new Date()
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user