feat:自定义历史聊天标题 (#41)

* feat:自定义历史聊天标题

* Update chat.ts

* perf:自定义聊天标题

* feat: google auth

* perf:将修改标题移入右键菜单

* perf:updatetitle

---------

Co-authored-by: archer <545436317@qq.com>
This commit is contained in:
Textcat
2023-05-29 20:36:28 +08:00
committed by GitHub
parent e818cb037f
commit 7fe39c2515
6 changed files with 169 additions and 11 deletions

View File

@@ -78,13 +78,14 @@ export async function saveChat({
return _id;
} else {
// 已经有记录,追加入库
const chat = await Chat.findById(chatId);
await Chat.findByIdAndUpdate(chatId, {
$push: {
content: {
$each: content
}
},
title: content[0].value.slice(0, 20),
...(chat && !chat.customTitle ? { title: content[0].value.slice(0, 20) } : {}),
latestChat: content[1].value,
updateTime: new Date()
});