mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-17 22:07:10 +00:00
feat: 进一步适配铃音+shamrock;词云进化
This commit is contained in:
parent
61d3b48781
commit
0bff8c85b0
7 changed files with 209 additions and 65 deletions
|
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue