Skip to content

Commit

Permalink
整理代码,为#gg 实时搜索对话 铺路
Browse files Browse the repository at this point in the history
  • Loading branch information
misaka20002 committed Dec 19, 2024
1 parent 9de35f3 commit 4a7f934
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 33 deletions.
27 changes: 14 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,15 @@ git clone https://github.com/AIGC-Yunzai/siliconflow-plugin.git ./plugins/silico
```

> [!NOTE]
> 如果你的网络环境较差,无法连接到 Github,可以使用 [GitHub Proxy](https://cf.ghproxy.cc/) 提供的文件代理加速下载服务
> 如果你的网络环境较差,无法连接到 Github,可以使用 [GitHub Proxy](https://cf.ghproxy.cc/) 提供的文件代理加速下载服务
>
> ```
> ```bash
> git clone https://cf.ghproxy.cc/https://github.com/AIGC-Yunzai/siliconflow-plugin.git ./plugins/siliconflow-plugin
> ```
> 如果已经下载过本插件需要修改代理加速下载服务地址,在插件根目录使用:
> ```bash
> git remote set-url origin https://cf.ghproxy.cc/https://github.com/AIGC-Yunzai/siliconflow-plugin.git
> ```
#### 2. 安装依赖
Expand All @@ -39,8 +43,11 @@ pnpm install --filter=siliconflow-plugin
```
curl -sL Gitee.com/eggacheb/parser/raw/master/ver | bash
```
#### 教程
- [SF-PULGIN配置教程](https://aigc-yunzai.dwe.me/siliconflow/%E5%A6%82%E4%BD%95%E9%85%8D%E7%BD%AE) 🍈

#### 绘画辅助工具
- [AI画图Tags生产站](https://nai4-tag-select.pages.dev/) 🥭
- [直链服务器,一键复制huggingface空间](https://huggingface.co/spaces/xiaozhian/slink/tree/main?duplicate=true) 🍉
- [Stable Diffusion教程](https://waytoagi.feishu.cn/wiki/FUQAwxfH9iXqC9k02nYcDobonkf) 🍇
- [Midjourney基础教程](https://waytoagi.feishu.cn/wiki/VUadwndc5iRJktkzaYPcaLEynZc) 🍊
Expand All @@ -49,7 +56,6 @@ curl -sL Gitee.com/eggacheb/parser/raw/master/ver | bash
- [又一个prompt参考站](https://catjourney.life/all) 🍌
- [Midjourney Prompt生成器](https://promptfolder.com/midjourney-prompt-helper/) 🥝
- [MJ和SD Prompt生成器相关合集](https://waytoagi.feishu.cn/wiki/TQogw5uIziB4fykbGhSciaQfndm?table=tbl5kMFjDDdeYoAt&view=vew8AJm3cI) 🍑
- [帮你生成NovelAI的tag](https://nai4-tag-select.pages.dev/) 🥭

## 插件配置

Expand All @@ -72,24 +78,19 @@ curl -sL Gitee.com/eggacheb/parser/raw/master/ver | bash
- [x] 接入Fishaudio语音合成
- [x] 支持图片直链获取
- [X] #ss 对话 MD 图片输出
- [ ] 接入更多LLM推理
- [ ] 接入更多语音合成
- [ ] TODO...
- [ ] #gg 对话实现实时搜索功能
- [ ] TODO..

## 支持与贡献

如果你喜欢这个项目,请不妨点个 Star🌟,这是对开发者最大的动力。

有意见或者建议也欢迎提交 [Issues](https://github.com/AIGC-Yunzai/siliconflow-plugin/issues)[Pull requests](https://github.com/AIGC-Yunzai/siliconflow-plugin/pulls)

## 相关项目
## 感谢

- [vits-plugin](https://github.com/erzaozi/vits-plugin):一个适用于 Yunzai 系列机器人框架 的的 AI 语音合成插件,让你能够在机器人中使用 AI 语音合成功能
- [Fish-Audio](https://fish.audio):Brand new TTS solution
## 感谢
- [vits-plugin](https://github.com/erzaozi/vits-plugin):Fishaudio语音同传的方式绝大部分参考了该项目的实现方法,Fish-Audio.json也是直接用的该项目的,很是感谢
- 所以fishaudio发音人名称可以看[发音人名称](https://github.com/erzaozi/vits-plugin#fish-audio)
- [vits-plugin](https://github.com/erzaozi/vits-plugin):一个适用于 Yunzai 系列机器人框架 的的 AI 语音合成插件,让你能够在机器人中使用 AI 语音合成功能;Fishaudio语音同传的方式绝大部分参考了该项目的实现方法,Fish-Audio.json也是直接用的该项目的,很是感谢!


## 许可证
Expand Down
23 changes: 3 additions & 20 deletions apps/SF_Painting.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ import {
url2Base64,
} from '../utils/getImg.js'
import { handleParam } from '../utils/parse.js'
import fs from 'fs'
import puppeteer from "../../../lib/puppeteer/puppeteer.js";

const _path = process.cwd();
import { markdown_screenshot } from '../utils/markdownPic.js'

export class SF_Painting extends plugin {
constructor() {
Expand Down Expand Up @@ -180,29 +177,16 @@ export class SF_Painting extends plugin {

// 获取markdown开关配置,默认为false
const useMarkdown = config_date?.ss_useMarkdown ?? false
logger.mark(`[sf插件] markdown开关状态: ${useMarkdown}`)

try {
if (useMarkdown) {
logger.mark('[sf插件] 正在生成markdown图片...')
// 构建对话数据
const data = {
_path,
tplFile: './plugins/siliconflow-plugin/resources/markdownPic/index.html',
content: answer,
userId: e.user_id,
botId: e.self_id,
userMsg: msg
}

// 使用云崽的puppeteer截图
const img = await puppeteer.screenshot("markdown", data);
const img = await markdown_screenshot(e.user_id, e.self_id, msg, answer);
if (img) {
await e.reply({ ...img, origin: true }, true)
} else {
logger.error('[sf插件] markdown图片生成失败')
}
e.reply(await common.makeForwardMsg(e, [answer], (e.sender.card || e.sender.nickname || e.user_id) + ":" + msg));
e.reply(await common.makeForwardMsg(e, [answer], (e.sender.card || e.sender.nickname || e.user_id) + ":" + msg.substring(0, 50)));
} else {
await e.reply(answer, true)
}
Expand All @@ -212,7 +196,6 @@ export class SF_Painting extends plugin {
}
}


/**
* @description: 自动提示词
* @param {*} input
Expand Down
24 changes: 24 additions & 0 deletions utils/markdownPic.js
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;
}

0 comments on commit 4a7f934

Please sign in to comment.