mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-16 21:37:11 +00:00
fix: 依赖
This commit is contained in:
parent
3cfbe9eae7
commit
e0d3395a77
2 changed files with 15 additions and 2 deletions
|
|
@ -64,7 +64,11 @@ export class Entertainment extends plugin {
|
|||
}
|
||||
await e.reply('在统计啦,请稍等...')
|
||||
await redis.set('CHATGPT:WORDCLOUD:ALL', '1', { EX: 600 })
|
||||
try {
|
||||
await makeWordcloud(e, e.group_id)
|
||||
} catch (err) {
|
||||
await e.reply(err)
|
||||
}
|
||||
await redis.del('CHATGPT:WORDCLOUD:ALL')
|
||||
} else {
|
||||
await e.reply('请在群里发送此命令')
|
||||
|
|
|
|||
|
|
@ -1,6 +1,12 @@
|
|||
import nodejieba from 'nodejieba'
|
||||
import { Config } from '../config.js'
|
||||
|
||||
let nodejieba
|
||||
try {
|
||||
nodejieba = await import('nodejieba').default
|
||||
} catch (err) {
|
||||
logger.info('未安装nodejieba,娱乐功能-词云统计不可用')
|
||||
}
|
||||
|
||||
export class Tokenizer {
|
||||
async getTodayHistory (groupId, date = new Date()) {
|
||||
if (!groupId) {
|
||||
|
|
@ -32,6 +38,9 @@ export class Tokenizer {
|
|||
}
|
||||
|
||||
async getTodayKeywordTopK (groupId, topK = 100) {
|
||||
if (!nodejieba) {
|
||||
throw new Error('未安装nodejieba,娱乐功能-词云统计不可用')
|
||||
}
|
||||
let chats = await this.getTodayHistory(groupId)
|
||||
let chatContent = chats
|
||||
.map(c => c.raw_message
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue