mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-17 13:57:10 +00:00
fix: new group or member wordcloud bug
This commit is contained in:
parent
1475768df8
commit
21fc4cbe45
1 changed files with 8 additions and 2 deletions
|
|
@ -37,9 +37,15 @@ export class Tokenizer {
|
||||||
const endOfSpecifiedDate = startOfSpecifiedDate + (24 * 60 * 60 * 1000)
|
const endOfSpecifiedDate = startOfSpecifiedDate + (24 * 60 * 60 * 1000)
|
||||||
while (isTimestampInDateRange(chats[0]?.time, startOfSpecifiedDate, endOfSpecifiedDate) && isTimestampInDateRange(chats[chats.length - 1]?.time, startOfSpecifiedDate, endOfSpecifiedDate)) {
|
while (isTimestampInDateRange(chats[0]?.time, startOfSpecifiedDate, endOfSpecifiedDate) && isTimestampInDateRange(chats[chats.length - 1]?.time, startOfSpecifiedDate, endOfSpecifiedDate)) {
|
||||||
let chatHistory = await group.getChatHistory(seq, 20)
|
let chatHistory = await group.getChatHistory(seq, 20)
|
||||||
|
if (chatHistory.length === 1) {
|
||||||
|
if (chats[0].seq === chatHistory[0].seq) {
|
||||||
|
// 昨天没有聊天记录 比如新建的群 新进群的机器人 会卡在某一条
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
chats.push(...chatHistory)
|
chats.push(...chatHistory)
|
||||||
chats.sort(compareByTime)
|
chats.sort(compareByTime)
|
||||||
seq = chats[0].seq
|
seq = chatHistory[0].seq
|
||||||
if (Config.debug) {
|
if (Config.debug) {
|
||||||
logger.info(`拉取到${chatHistory.length}条聊天记录,当前已累计获取${chats.length}条聊天记录,继续拉...`)
|
logger.info(`拉取到${chatHistory.length}条聊天记录,当前已累计获取${chats.length}条聊天记录,继续拉...`)
|
||||||
}
|
}
|
||||||
|
|
@ -56,7 +62,7 @@ export class Tokenizer {
|
||||||
logger.mark(`聊天记录拉去完成,获取到今日内${chats.length}条聊天记录,准备分词中`)
|
logger.mark(`聊天记录拉去完成,获取到今日内${chats.length}条聊天记录,准备分词中`)
|
||||||
let chatContent = chats
|
let chatContent = chats
|
||||||
.map(c => c.raw_message
|
.map(c => c.raw_message
|
||||||
.duoreplaceAll('[图片]', '')
|
.replaceAll('[图片]', '')
|
||||||
.replaceAll('[表情]', '')
|
.replaceAll('[表情]', '')
|
||||||
.replaceAll('[动画表情]', '')
|
.replaceAll('[动画表情]', '')
|
||||||
.replaceAll('[语音]', '')
|
.replaceAll('[语音]', '')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue