-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9de35f3
commit 4a7f934
Showing
3 changed files
with
41 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import puppeteer from "../../../lib/puppeteer/puppeteer.js"; | ||
const _path = process.cwd(); | ||
|
||
/** | ||
* @description: 生成对话内容的markdown图片 | ||
* @param {number} userId 用户ID e.user_id;用于第一个头像显示 | ||
* @param {number} botId 机器人ID e.self_id;用于第二个头像显示 | ||
* @param {string} userMsg user输入内容 | ||
* @param {string} answer bot回复内容 | ||
* @return {object} 图片对象 | ||
*/ | ||
export async function markdown_screenshot(userId, botId, userMsg, answer) { | ||
logger.mark('[sf插件] 正在生成markdown图片...') | ||
const data = { | ||
_path, | ||
tplFile: './plugins/siliconflow-plugin/resources/markdownPic/index.html', | ||
content: answer, | ||
userId, | ||
botId, | ||
userMsg | ||
} | ||
const img = await puppeteer.screenshot("markdown", data); | ||
return img; | ||
} |