mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-16 13:27:08 +00:00
fix: node-rs jieba error
This commit is contained in:
parent
db72462b8e
commit
c35c3a66ce
1 changed files with 7 additions and 3 deletions
|
|
@ -4,7 +4,7 @@ let nodejieba
|
|||
try {
|
||||
nodejieba = (await import('@node-rs/jieba')).default
|
||||
} catch (err) {
|
||||
logger.info('未安装nodejieba,娱乐功能-词云统计不可用')
|
||||
logger.info('未安装@node-rs/jieba,娱乐功能-词云统计不可用')
|
||||
}
|
||||
|
||||
export class Tokenizer {
|
||||
|
|
@ -56,11 +56,15 @@ export class Tokenizer {
|
|||
|
||||
async getTodayKeywordTopK (groupId, topK = 100) {
|
||||
if (!nodejieba) {
|
||||
throw new Error('未安装nodejieba,娱乐功能-词云统计不可用')
|
||||
throw new Error('未安装node-rs/jieba,娱乐功能-词云统计不可用')
|
||||
}
|
||||
let chats = await this.getTodayHistory(groupId)
|
||||
logger.mark(`聊天记录拉去完成,获取到今日内${chats.length}条聊天记录,准备分词中`)
|
||||
nodejieba.load()
|
||||
try {
|
||||
nodejieba.load()
|
||||
} catch (err) {
|
||||
// ignore already load error
|
||||
}
|
||||
let chatContent = chats
|
||||
.map(c => c.raw_message
|
||||
.replaceAll('[图片]', '')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue