feat: 最近对话

This commit is contained in:
CrescentLeaf
2025-10-04 14:32:22 +08:00
parent 89db6591a0
commit 04989762d9
3 changed files with 34 additions and 16 deletions

View File

@@ -132,9 +132,9 @@ export default class User {
map.set(chatId, content)
this.setAttr("recent_chats", JSON.stringify(map, MapJson.replacer))
}
getRecentChats() {
getRecentChats(): Map<string, string> {
try {
return JSON.parse(this.bean.recent_chats, MapJson.reviver) as Map<string, string>
return JSON.parse(this.bean.recent_chats, MapJson.reviver)
} catch (e) {
console.log(chalk.yellow(`警告: 最近对话列表解析失敗: ${(e as Error).message}`))
return new Map()