feat: 进一步适配铃音+shamrock;词云进化

This commit is contained in:
ikechan8370 2023-11-07 18:54:58 +08:00
parent 61d3b48781
commit 0bff8c85b0
7 changed files with 209 additions and 65 deletions

View file

@ -1,11 +1,19 @@
import { Tokenizer } from './tokenizer.js'
import { ShamrockTokenizer, Tokenizer } from './tokenizer.js'
import { render } from '../common.js'
export async function makeWordcloud (e, groupId, duration = 0) {
let tokenizer = new Tokenizer()
let topK = await tokenizer.getKeywordTopK(groupId, 100, duration)
export async function makeWordcloud (e, groupId, duration = 0, userId) {
let tokenizer = getTokenizer(e)
let topK = await tokenizer.getKeywordTopK(e, groupId, 100, duration, userId)
let list = JSON.stringify(topK)
// let list = topK
console.log(list)
await render(e, 'chatgpt-plugin', 'wordcloud/index', { list })
logger.info(list)
let img = await render(e, 'chatgpt-plugin', 'wordcloud/index', { list }, { retType: 'base64' })
await e.reply(img, true)
}
function getTokenizer (e) {
if (e.adapter === 'shamrock') {
return new ShamrockTokenizer()
} else {
return new Tokenizer()
}
}