chatgpt-plugin/utils/wordcloud/wordcloud.js
ikechan8370 cb3e57bea3
feat: experimental markdown support (#658)
* feat: test button

* fix: enter

* fix: bing suggested

* fix: bing suggested

* fix: bing suggested

* fix: button under icqq

* fix: 删除suno心跳

* fix: add default md handler

* fix: duplicate this

* fix: add a button

* Update md.js

* Update md.js

* fix: api stream

* fix: claude.ai

* fix: md enhancement

* fix: optional buttons

* fix: mode name

* fix: ignore md while not enable md
2024-03-05 14:12:50 +08:00

19 lines
596 B
JavaScript

import { ShamrockTokenizer, Tokenizer } from './tokenizer.js'
import { render } from '../common.js'
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)
logger.info(list)
let img = await render(e, 'chatgpt-plugin', 'wordcloud/index', { list }, { retType: 'base64' })
return img
}
function getTokenizer (e) {
if (e.adapter === 'shamrock') {
return new ShamrockTokenizer()
} else {
return new Tokenizer()
}
}