Giter Club home page Giter Club logo

wechaty-plugin-assistant's Introduction

微信智能对话机器人

使用 wechaty 开发的聊天助手插件,内置多种AI大模型,只需三步即可轻松创建一个智能对话机器人

Powered by Wechaty

Report Bug · Request Feature

Warning

发现使用 Node 20,在服务器启动会报一堆的 AssertError 错误,使用 Node 18 较为稳定。 AssertError 错误后,可能出现 自动重试,导致可能的 重复消息自动退出,原因未知

目录树

TOC


✨ 功能特性

  • 🚀 快速开始: 只需简单三步,即可轻松启动智能对话机器人。
  • 💡 关注点分离: 通过抽象 助手上下文大模型 的概念,更方便地理解和应用,以应对复杂的对话场景。
  • 💬 用户对话: 专注于处理用户私聊和群内被提及的消息,避免大模型被大量消息阻塞。
  • 处理等待: 如果 AI 尚未回应,自动拒绝新消息的处理,确保对话流畅。
  • 🪡 自由定制: 考虑到二次开发的需求,可以方便地拓展助手功能,满足个性化需求。

📖 使用文档

教程

文章

📦 安装

要安装 @zhengxs/wechaty-plugin-assistant,请运行以下命令:

$ pnpm install @zhengxs/wechaty-plugin-assistant

👋 使用

在这里获取你的 accessToken 值。

import {
  ChatERNIEBot,
  createAssistant,
} from '@zhengxs/wechaty-plugin-assistant';
import { WechatyBuilder } from 'wechaty';
import { QRCodeTerminal } from 'wechaty-plugin-contrib';

// ============ 第一步:选择大模型  ============

const llm = new ChatERNIEBot({
  token: process.env.EB_ACCESS_TOKEN, // 飞桨平台的 token
});

// ============ 第二步:创建 AI 助手  ============

const assistant = createAssistant({
  llm,
});

// ============ 第三步:启动 wechaty 服务  ============

const bot = WechatyBuilder.build({
  name: 'demo',
  puppet: 'wechaty-puppet-wechat4u',
  puppetOptions: { uos: true },
});

bot.use(QRCodeTerminal({ small: true }));

// 作为插件使用
bot.use(assistant.callback());

bot.start();

同时接入多个大模型。

import {
  ChatERNIEBot,
  ChatQWen,
  createAssistant,
  MultiChatModelSwitch,
} from '@zhengxs/wechaty-plugin-assistant';

const assistant = createAssistant({
  llm: new MultiChatModelSwitch([
    new ChatERNIEBot(),
    new ChatQWen(),
    // more...
  ]),
});

🧰 内置功能

口令

口令 描述
新对话 \ 新聊天 \ 重新开始 模拟 Web UI 的 创建新聊天 功能
停止 \ 停止回复 模拟 Web UI 的 停止生成 按钮
查看模型 \ 切换 xxx MultiChatModelSwitch 模块添加的功能,允许配置多个模型,由最终使用者自己切换

指令

Note

不再内置指令,改为按需手动注册。

名称 描述 状态
/deepl DeepL 翻译,感谢 bob-plugin-akl-deepl-free-translate 提供的代码 以及 deepL 提供服务 Alpha
/dict 汉字解释,感谢 Pear 提供的 API Alpha
/hot 热搜榜,感谢 韩小韩 提供的 API Alpha
/kfc 疯狂星期四文案,感谢 Brick 提供的 API Alpha
/moyu 摸鱼日历,感谢 韩小韩 提供的 API 以及 摸鱼日历 提供的图片 Alpha

🪢 AI 模型

目前仅支持官方 API 调用,暂不提供 Web API 的代理。

名称 公司 描述 代码 状态
文心一言 百度 支持 百度千帆AI Studio 的 API 调用 ChatERNIEBot Alpha
通义千问 阿里 支持阿里云 DashScope 的大部分模型,如qwenqwen-vl 系列的模型 ChatQWen Alpha
混元助手 腾讯 ChatHunYuan Alpha
星火认知 讯飞 支持 1.5 | 2 | 3 模型 ChatSpark Alpha
MM智能助理 稀宇科技 支持 abab5-chat | abab5.5-chat | abab5.5-chat-pro 模型 ChatMinimax Alpha
Claude Anthropic 基于 Claude Web API,内部已配置 反向代理服务 ChatClaudeAI Alpha
ChatGPT OpenAI 推荐 代理 ChatOpenAI Alpha
Bard Google - N/A

⌨️ 本地开发

可以使用 GitHub Codespaces 进行在线开发:

或者使用以下命令进行本地开发:

$ git clone https://github.com/zhengxs2018/wechaty-plugin-assistant.git
$ cd wechaty-plugin-assistant
$ pnpm install
$ pnpm dev

🔗 更多工具

🤝 参与贡献

我们非常欢迎各种形式的贡献。如果你对贡献代码感兴趣,可以查看我们的 GitHub Issues 大展身手,向我们展示你的奇思妙想。

🕘 Star History

Star History Chart


📝 License

Copyright © 2023 zhengxs2018.
This project is MIT licensed.

wechaty-plugin-assistant's People

Contributors

zhengxs2018 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.