├── .github └── workflows │ └── main.yml ├── .gitignore ├── .vitepress ├── config.mjs └── theme │ ├── HomeFeaturesAfter.vue │ ├── Sponsors.vue │ ├── index.js │ └── style.css ├── README.md ├── community.md ├── config ├── astrbot-config.md ├── model-config.md └── providers │ ├── dashscope.md │ ├── dify.md │ ├── llm.md │ ├── oneapi.md │ ├── ppio.md │ ├── provider-lmstudio.md │ └── provider-ollama.md ├── deploy ├── astrbot │ ├── btpanel.md │ ├── casaos.md │ ├── cli.md │ ├── docker.md │ ├── image-1.png │ ├── image-2.png │ ├── image.png │ ├── linux-one.md │ ├── rainyun.md │ └── windows.md ├── platform │ ├── 8287fd9fec5823847e6b590dc3f0f545.png │ ├── aiocqhttp │ │ ├── lagrange.md │ │ ├── napcat.md │ │ └── others.md │ ├── dingtalk.md │ ├── gewechat.md │ ├── image.png │ ├── lark.md │ ├── qqofficial │ │ ├── webhook.md │ │ └── websockets.md │ ├── telegram.md │ ├── wechat │ │ ├── gewechat.md │ │ └── wechatpadpro.md │ ├── wecom.md │ └── weixin-official-account.md └── when-deployed.md ├── dev ├── core │ ├── overall_architecture.md │ └── overall_operation_process.md ├── plugin-platform-adapter.md ├── plugin-publish.md ├── plugin.md └── star │ ├── all_resources.md │ ├── plugin.md │ └── resources │ ├── astr_message_event.md │ ├── astrbot_message.md │ ├── context.md │ ├── message_member.md │ ├── message_type.md │ ├── platform_metadata.md │ ├── star.md │ └── star_metadata.md ├── faq.md ├── index.md ├── ospp └── 2025.md ├── others ├── dashscope.md ├── github-proxy.md ├── platform.md ├── provider.md └── self-host-t2i.md ├── package-lock.json ├── package.json ├── source ├── archive │ └── 1logo.png └── images │ ├── btpanel │ ├── image-1.png │ ├── image-2.png │ └── image.png │ ├── casaos │ ├── image-1.png │ ├── image-2.png │ ├── image-3.png │ ├── image-4.png │ └── image.png │ ├── cli │ ├── image-1.png │ └── image.png │ ├── code-interpreter │ ├── a3cd3a0e-aca5-41b2-aa52-66b568bd955b.png │ ├── image-1.png │ ├── image-2.png │ ├── image-3.png │ ├── image-4.png │ └── image.png │ ├── dashscope │ ├── image-1.png │ ├── image-2.png │ ├── image-3.png │ └── image.png │ ├── dev │ └── overall_structure.png │ ├── dify │ ├── image-1.png │ ├── image-2.png │ ├── image-3.png │ ├── image-4.png │ ├── image-5.png │ └── image.png │ ├── dingtalk │ ├── image-10.png │ ├── image-11.png │ ├── image-12.png │ ├── image-4.png │ ├── image-5.png │ ├── image-6.png │ ├── image-7.png │ ├── image-8.png │ └── image-9.png │ ├── docker │ ├── image-1.png │ ├── image-2.png │ ├── image-3.png │ ├── image-4.png │ ├── image-5.png │ ├── image-6.png │ ├── image-7.png │ └── image.png │ ├── faq │ ├── image-1.png │ └── image.png │ ├── function-calling │ ├── image-1.png │ ├── image.png │ ├── image2.png │ └── image3.png │ ├── gewechat │ ├── image-1.png │ └── image.png │ ├── github-proxy │ └── image.png │ ├── knowledge-base │ ├── QQ_1748619436297.png │ ├── QQ_1748619486233.png │ ├── QQ_1748619867978.png │ ├── QQ_1748619964591.png │ ├── QQ_1748620019676.png │ └── QQ_1748620695533.png │ ├── lark │ ├── image-1.png │ ├── image-10.png │ ├── image-11.png │ ├── image-12.png │ ├── image-13.png │ ├── image-2.png │ ├── image-3.png │ ├── image-4.png │ ├── image-5.png │ ├── image-6.png │ ├── image-7.png │ ├── image-8.png │ ├── image-9.png │ └── image.png │ ├── linux-one │ └── 5bae97bb68f367923f63dd3f1607a7df.png │ ├── llm │ ├── image-1.png │ └── image.png │ ├── logo_deprecated.svg │ ├── logo_prod.png │ ├── model-config │ ├── image-2.png │ └── image.png │ ├── napcat │ ├── image-1.png │ └── image.png │ ├── oneapi │ ├── image-1.png │ └── image.png │ ├── plugin-platform-adapter │ ├── QQ_1738155926221.png │ ├── QQ_1738155982211.png │ └── QQ_1738156166893.png │ ├── plugin-publish │ └── image.png │ ├── plugin │ ├── 898a169ae7ed0478f41c0a7d14cb4d64.png │ ├── QQ_1738149538737.png │ ├── db93a2bb-671c-4332-b8ba-9a91c35623c2.png │ ├── fcc2dcb472a91b12899f617477adc5c7.png │ ├── image-1.png │ ├── image-2.png │ ├── image-3.png │ ├── image-4.png │ ├── image-5.png │ ├── image-6.png │ ├── image-7.png │ └── image.png │ ├── ppio │ ├── image-1.png │ ├── image-2.png │ ├── image-3.png │ └── image.png │ ├── provider-model-config │ └── image.png │ ├── provider-ollama │ └── image.png │ ├── provider │ ├── image-1.png │ ├── image-2.png │ ├── image-3.png │ ├── image-4.png │ ├── image-5.png │ └── image.png │ ├── qqofficial │ ├── image-1.png │ ├── image-2.png │ ├── image-3.png │ └── image.png │ ├── telegram │ └── image.png │ ├── tts │ ├── image-1.png │ ├── image-2.png │ ├── image-3.png │ ├── image-4.png │ └── image.png │ ├── vchat │ ├── image-1.png │ └── image.png │ ├── webhook │ ├── image-1.png │ └── image.png │ ├── webui │ ├── image-1.png │ ├── image-2.png │ ├── image-3.png │ └── image.png │ ├── wechatpadpro │ ├── image-1.png │ ├── image-2.png │ ├── image-3.png │ ├── image-4.png │ ├── image-5.png │ └── image.png │ ├── wecom │ ├── 3dc9fa61145ab0dd8f56a10295affec8_720.png │ ├── image-1.png │ ├── image-10.png │ ├── image-11.png │ ├── image-12.png │ ├── image-13.png │ ├── image-2.png │ ├── image-3.png │ ├── image-4.png │ ├── image-5.png │ ├── image-6.png │ ├── image-7.png │ ├── image-8.png │ ├── image-9.png │ └── image.png │ ├── what-is-astrbot │ ├── image-1.png │ └── image.png │ ├── whisper │ └── image.png │ └── windows │ ├── image-1.png │ ├── image-2.png │ ├── image-3.png │ ├── image-4.png │ └── image.png ├── use ├── code-interpreter.md ├── command.md ├── function-calling.md ├── image-1.png ├── image-2.png ├── image.png ├── knowledge-base.md ├── mcp.md ├── plugin.md ├── tts.md ├── update-webui.md ├── websearch.md ├── webui.md └── whisper.md └── what-is-astrbot.md /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: release 2 | 3 | on: 4 | push: 5 | branches: v2 6 | 7 | jobs: 8 | build: 9 | runs-on: ubuntu-latest # 运行环境 10 | steps: 11 | - name: checkout 12 | uses: actions/checkout@master 13 | - name: nodejs installation 14 | uses: actions/setup-node@v2 15 | with: 16 | node-version: "18" 17 | - name: npm install 18 | run: npm add -D vitepress 19 | working-directory: './' # working-directory 指定 shell 命令运行目录 20 | - name: npm run build 21 | run: npm run docs:build 22 | working-directory: './' 23 | - name: scp 24 | uses: appleboy/scp-action@master 25 | with: 26 | host: ${{ secrets.HOST_NEKO }} 27 | username: ${{ secrets.USERNAME }} 28 | password: ${{ secrets.PASSWORDNEKO }} 29 | source: '.vitepress/dist/*' 30 | target: '/tmp/' 31 | - name: script 32 | uses: appleboy/ssh-action@master 33 | with: 34 | host: ${{ secrets.HOST_NEKO }} 35 | username: ${{ secrets.USERNAME }} 36 | password: ${{ secrets.PASSWORDNEKO }} 37 | script: | 38 | rm -rf /root/docker_data/caddy/caddy_data/static_site/abv2/* 39 | mv /tmp/.vitepress/dist/* /root/docker_data/caddy/caddy_data/static_site/abv2/ 40 | rm -rf /tmp/.vitepress/ 41 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__/ 2 | venv/ 3 | .DS_Store 4 | node_modules/ 5 | .vitepress/cache -------------------------------------------------------------------------------- /.vitepress/config.mjs: -------------------------------------------------------------------------------- 1 | import { defineConfig } from "vitepress"; 2 | 3 | // https://vitepress.dev/reference/site-config 4 | export default defineConfig({ 5 | title: "AstrBot", 6 | description: "AstrBot", 7 | themeConfig: { 8 | // https://vitepress.dev/reference/default-theme-config 9 | nav: [ 10 | { text: "主页", link: "/" }, 11 | { text: "开始", link: "/what-is-astrbot" }, 12 | ], 13 | 14 | search: { 15 | provider: "local", 16 | }, 17 | 18 | sidebar: [ 19 | { 20 | text: "简介", 21 | items: [ 22 | { text: "什么是 AstrBot", link: "/what-is-astrbot" }, 23 | { text: "社区", link: "/community" }, 24 | { text: "常见问题", link: "/faq" }, 25 | ], 26 | }, 27 | { 28 | text: "开源之夏", 29 | base: "/ospp", 30 | collapsed: false, 31 | items: [ 32 | { text: "OSPP 2025", link: "/2025" }, 33 | ], 34 | }, 35 | { 36 | text: "部署", 37 | base: "/deploy", 38 | collapsed: false, 39 | items: [ 40 | { 41 | text: "部署 AstrBot", 42 | base: "/deploy/astrbot", 43 | collapsed: true, 44 | items: [ 45 | { text: "🦈 Docker 部署", link: "/docker" }, 46 | { text: "☁️ 雨云一键云部署(NEW)", link: "/rainyun" }, 47 | { text: "💻 Windows 一键部署", link: "/windows" }, 48 | { text: "👍 手动部署", link: "/cli" }, 49 | { text: "😁 宝塔面板部署", link: "/btpanel" }, 50 | { text: "😊 CasaOS 部署", link: "/casaos" }, 51 | { text: "😌 社区提供的部署脚本", link: "/linux-one" }, 52 | ], 53 | }, 54 | { 55 | text: "部署消息平台(协议端)", 56 | base: "/deploy/platform", 57 | collapsed: true, 58 | items: [ 59 | { 60 | text: "QQ 官方接口", 61 | base: "/deploy/platform/qqofficial", 62 | collapsed: true, 63 | items: [ 64 | { text: "Webhook 方式", link: "/webhook" }, 65 | { text: "Websockets 方式", link: "/websockets" }, 66 | ], 67 | }, 68 | { 69 | text: "QQ 个人号", 70 | base: "/deploy/platform/aiocqhttp", 71 | collapsed: true, 72 | items: [ 73 | { text: "使用 NapCat", link: "/napcat" }, 74 | { text: "使用 Lagrange", link: "/lagrange" }, 75 | { text: "使用其他端", link: "/others" }, 76 | ], 77 | }, 78 | { text: "企业微信", link: "/wecom" }, 79 | { text: "微信公众平台", link: "/weixin-official-account" }, 80 | { 81 | text: "微信个人号", 82 | base: "/deploy/platform/wechat", 83 | collapsed: true, 84 | items: [ 85 | { text: "使用 WeChatPadPro", link: "/wechatpadpro" }, 86 | { text: "使用 Gewechat", link: "/gewechat" }, 87 | ], 88 | }, 89 | { text: "飞书", link: "/lark" }, 90 | { text: "钉钉", link: "/dingtalk" }, 91 | { text: "Telegram", link: "/telegram" }, 92 | ], 93 | }, 94 | { 95 | text: "部署好后...", 96 | link: "/when-deployed", 97 | }, 98 | ], 99 | }, 100 | { 101 | text: "配置", 102 | base: "/config", 103 | collapsed: false, 104 | items: [ 105 | { 106 | text: "接入大模型服务", 107 | base: "/config/providers", 108 | collapsed: true, 109 | items: [ 110 | { text: "接入 PPIO 派欧云模型服务", link: "/ppio" }, 111 | { text: "接入 OpenAI、DeepSeek 等各种模型", link: "/llm" }, 112 | { 113 | text: "接入 Dify", 114 | link: "/dify", 115 | }, 116 | { 117 | text: "接入 阿里云百炼应用", 118 | link: "/dashscope", 119 | }, 120 | { 121 | text: "接入 Ollama 使用 DeepSeek-R1 等模型", 122 | link: "/provider-ollama", 123 | }, 124 | { 125 | text: "接入 LMStudio 使用 DeepSeek-R1 等模型", 126 | link: "/provider-lmstudio", 127 | }, 128 | { 129 | text: "接入 OneAPI", 130 | link: "/oneapi", 131 | }, 132 | ], 133 | }, 134 | { 135 | text: "AstrBot 配置文件", 136 | link: "/astrbot-config", 137 | }, 138 | { 139 | text: "自定义温度等模型参数", 140 | link: "/model-config", 141 | }, 142 | ], 143 | }, 144 | { 145 | text: "使用", 146 | base: "/use", 147 | collapsed: false, 148 | items: [ 149 | { 150 | text: "管理面板", 151 | link: "/webui", 152 | }, 153 | { 154 | text: "AstrBot Star(插件)", 155 | link: "/plugin", 156 | }, 157 | { 158 | text: "内置指令", 159 | link: "/command", 160 | }, 161 | { 162 | text: "函数调用", 163 | link: "/function-calling", 164 | }, 165 | { 166 | text: "MCP", 167 | link: "/mcp", 168 | }, 169 | { 170 | text: "网页搜索", 171 | link: "/websearch", 172 | }, 173 | { 174 | text: "知识库", 175 | link: "/knowledge-base", 176 | }, 177 | { 178 | text: "沙箱化代码执行器(beta)", 179 | link: "/code-interpreter", 180 | }, 181 | { 182 | text: "配置 Whisper 语音转文字", 183 | link: "/whisper", 184 | }, 185 | { 186 | text: "配置文字转语音(TTS)", 187 | link: "/tts", 188 | }, 189 | { 190 | text: "更新管理面板", 191 | link: "/update-webui", 192 | }, 193 | ], 194 | }, 195 | { 196 | text: "开发", 197 | base: "/dev", 198 | collapsed: false, 199 | items: [ 200 | { 201 | text: "核心代码解释", 202 | base: "/dev/core", 203 | collapsed: true, 204 | items: [ 205 | { text: "整体架构", link: "/overall_architecture" }, 206 | { text: "运行流程", link: "/overall_operation_process" }, 207 | ], 208 | }, 209 | { 210 | text: "插件开发", 211 | base: "/dev/star", 212 | collapsed: true, 213 | items: [ 214 | { text: "插件基础开发", link: "/plugin" }, 215 | { text: "插件数据目录", link: "/all_resources" }, 216 | { 217 | text: "插件开发数据", 218 | base: "/dev/star/resources", 219 | collapsed: true, 220 | items: [ 221 | { text: "AstrMessageEvent", link: "/astr_message_event" }, 222 | { text: "AstrBotMessage", link: "/astrbot_message" }, 223 | { text: "MessageType", link: "/message_type" }, 224 | { text: "MessageMember", link: "/message_member" }, 225 | { text: "Context", link: "/context" }, 226 | { text: "Star", link: "/star" }, 227 | { text: "StarMetadata", link: "/star_metadata" }, 228 | { text: "PlatformMetadata", link: "/platform_metadata" }, 229 | ], 230 | }, 231 | ], 232 | }, 233 | { 234 | text: "接入平台适配器", 235 | link: "/plugin-platform-adapter", 236 | }, 237 | ], 238 | }, 239 | { 240 | text: "其他", 241 | base: "/others", 242 | collapsed: false, 243 | items: [ 244 | { 245 | text: "配置文件-大语言模型提供商", 246 | link: "/provider", 247 | }, 248 | { 249 | text: "配置文件-消息平台适配器", 250 | link: "/platform", 251 | }, 252 | { 253 | text: "自部署文转图", 254 | link: "/self-host-t2i", 255 | }, 256 | { 257 | text: "插件下载不了?试试自建 GitHub 加速服务", 258 | link: "/github-proxy", 259 | }, 260 | ], 261 | }, 262 | ], 263 | 264 | socialLinks: [ 265 | { icon: "github", link: "https://github.com/Soulter/AstrBot" }, 266 | ], 267 | }, 268 | }); 269 | -------------------------------------------------------------------------------- /.vitepress/theme/HomeFeaturesAfter.vue: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.vitepress/theme/Sponsors.vue: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.vitepress/theme/index.js: -------------------------------------------------------------------------------- 1 | // https://vitepress.dev/guide/custom-theme 2 | import { h } from 'vue' 3 | import DefaultTheme from 'vitepress/theme' 4 | import './style.css' 5 | import Sponsors from './Sponsors.vue' 6 | import HomeFeaturesAfter from './HomeFeaturesAfter.vue' 7 | 8 | /** @type {import('vitepress').Theme} */ 9 | export default { 10 | extends: DefaultTheme, 11 | Layout: () => { 12 | return h(DefaultTheme.Layout, null, { 13 | // https://vitepress.dev/guide/extending-default-theme#layout-slots 14 | "aside-ads-after": () => h(Sponsors), 15 | "home-features-after": () => h(HomeFeaturesAfter), 16 | }) 17 | }, 18 | enhanceApp({ app, router, siteData }) { 19 | // ... 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /.vitepress/theme/style.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Customize default theme styling by overriding CSS variables: 3 | * https://github.com/vuejs/vitepress/blob/main/src/client/theme-default/styles/vars.css 4 | */ 5 | 6 | /** 7 | * Colors 8 | * 9 | * Each colors have exact same color scale system with 3 levels of solid 10 | * colors with different brightness, and 1 soft color. 11 | * 12 | * - `XXX-1`: The most solid color used mainly for colored text. It must 13 | * satisfy the contrast ratio against when used on top of `XXX-soft`. 14 | * 15 | * - `XXX-2`: The color used mainly for hover state of the button. 16 | * 17 | * - `XXX-3`: The color for solid background, such as bg color of the button. 18 | * It must satisfy the contrast ratio with pure white (#ffffff) text on 19 | * top of it. 20 | * 21 | * - `XXX-soft`: The color used for subtle background such as custom container 22 | * or badges. It must satisfy the contrast ratio when putting `XXX-1` colors 23 | * on top of it. 24 | * 25 | * The soft color must be semi transparent alpha channel. This is crucial 26 | * because it allows adding multiple "soft" colors on top of each other 27 | * to create a accent, such as when having inline code block inside 28 | * custom containers. 29 | * 30 | * - `default`: The color used purely for subtle indication without any 31 | * special meanings attached to it such as bg color for menu hover state. 32 | * 33 | * - `brand`: Used for primary brand colors, such as link text, button with 34 | * brand theme, etc. 35 | * 36 | * - `tip`: Used to indicate useful information. The default theme uses the 37 | * brand color for this by default. 38 | * 39 | * - `warning`: Used to indicate warning to the users. Used in custom 40 | * container, badges, etc. 41 | * 42 | * - `danger`: Used to show error, or dangerous message to the users. Used 43 | * in custom container, badges, etc. 44 | * -------------------------------------------------------------------------- */ 45 | 46 | :root { 47 | --vp-c-default-1: var(--vp-c-gray-1); 48 | --vp-c-default-2: var(--vp-c-gray-2); 49 | --vp-c-default-3: var(--vp-c-gray-3); 50 | --vp-c-default-soft: var(--vp-c-gray-soft); 51 | 52 | --vp-c-brand-1: var(--vp-c-indigo-1); 53 | --vp-c-brand-2: var(--vp-c-indigo-2); 54 | --vp-c-brand-3: var(--vp-c-indigo-3); 55 | --vp-c-brand-soft: var(--vp-c-indigo-soft); 56 | 57 | --vp-c-tip-1: var(--vp-c-brand-1); 58 | --vp-c-tip-2: var(--vp-c-brand-2); 59 | --vp-c-tip-3: var(--vp-c-brand-3); 60 | --vp-c-tip-soft: var(--vp-c-brand-soft); 61 | 62 | --vp-c-warning-1: var(--vp-c-yellow-1); 63 | --vp-c-warning-2: var(--vp-c-yellow-2); 64 | --vp-c-warning-3: var(--vp-c-yellow-3); 65 | --vp-c-warning-soft: var(--vp-c-yellow-soft); 66 | 67 | --vp-c-danger-1: var(--vp-c-red-1); 68 | --vp-c-danger-2: var(--vp-c-red-2); 69 | --vp-c-danger-3: var(--vp-c-red-3); 70 | --vp-c-danger-soft: var(--vp-c-red-soft); 71 | } 72 | 73 | /** 74 | * Component: Button 75 | * -------------------------------------------------------------------------- */ 76 | 77 | :root { 78 | --vp-button-brand-border: transparent; 79 | --vp-button-brand-text: var(--vp-c-white); 80 | --vp-button-brand-bg: var(--vp-c-brand-3); 81 | --vp-button-brand-hover-border: transparent; 82 | --vp-button-brand-hover-text: var(--vp-c-white); 83 | --vp-button-brand-hover-bg: var(--vp-c-brand-2); 84 | --vp-button-brand-active-border: transparent; 85 | --vp-button-brand-active-text: var(--vp-c-white); 86 | --vp-button-brand-active-bg: var(--vp-c-brand-1); 87 | } 88 | 89 | /** 90 | * Component: Home 91 | * -------------------------------------------------------------------------- */ 92 | 93 | :root { 94 | --vp-home-hero-name-color: transparent; 95 | --vp-home-hero-name-background: -webkit-linear-gradient( 96 | 120deg, 97 | #bd34fe 30%, 98 | #41d1ff 99 | ); 100 | 101 | --vp-home-hero-image-background-image: linear-gradient( 102 | -45deg, 103 | #bd34fe 50%, 104 | #47caff 50% 105 | ); 106 | --vp-home-hero-image-filter: blur(44px); 107 | } 108 | 109 | @media (min-width: 640px) { 110 | :root { 111 | --vp-home-hero-image-filter: blur(56px); 112 | } 113 | } 114 | 115 | @media (min-width: 960px) { 116 | :root { 117 | --vp-home-hero-image-filter: blur(68px); 118 | } 119 | } 120 | 121 | /** 122 | * Component: Custom Block 123 | * -------------------------------------------------------------------------- */ 124 | 125 | :root { 126 | --vp-custom-block-tip-border: transparent; 127 | --vp-custom-block-tip-text: var(--vp-c-text-1); 128 | --vp-custom-block-tip-bg: var(--vp-c-brand-soft); 129 | --vp-custom-block-tip-code-bg: var(--vp-c-brand-soft); 130 | } 131 | 132 | /** 133 | * Component: Algolia 134 | * -------------------------------------------------------------------------- */ 135 | 136 | .DocSearch { 137 | --docsearch-primary-color: var(--vp-c-brand-1) !important; 138 | } 139 | 140 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # AstrBot 3 | _✨ 易上手的多平台 LLM 聊天机器人及开发框架(的官方文档) ✨_ 4 | 5 | [查看文档](https://astrbot.soulter.top/) | [问题提交](https://github.com/AstrBotDevs/AstrBot/issues) 6 | 7 | [AstrBot](https://github.com/AstrBotDevs/AstrBot) 是一个松耦合、异步、支持多消息平台部署、具有易用的插件系统和完善的大语言模型(LLM)接入功能的聊天机器人及开发框架。 8 | 9 | ![image](https://github.com/user-attachments/assets/48f72a71-9456-4166-bbd2-f2a6c8cd740f) 10 | 11 | -------------------------------------------------------------------------------- /community.md: -------------------------------------------------------------------------------- 1 | # 社区 2 | 3 | ## 社区渠道 4 | 5 | 本文档可能没有完全覆盖所有的功能,如果你有任何问题或者建议,或者发现了 AstrBot 或者是本文档的问题,欢迎通过下面的社区渠道联系我们。 6 | 7 | > [!TIP] 8 | > 为了该项目的可持续性,如果遇到问题,请优先提交 ISSUE,其次是在 QQ 群里提问。 9 | 10 | ### QQ 群 11 | 12 | > 1. 所有群都可以插空加入,如果您发现群人数小于上限,请尝试加入~ 13 | > 2. 我们不限制只能加入一个群聊,您可以根据需要加入多个群聊,但我们会不定时清理不活跃的成员。 14 | 15 | 1. 1 群: 322154837 (2000 人群, 已满) 16 | 2. 2 群: 945041621 (用于 Bot 测试) 17 | 3. 3 群: 630166526 (2000 人群, 已满) 18 | 4. 4 群: 775869627 (1000 人群, 已满) 19 | 5. 5 群: 822130018 (500 人群) 20 | 6. **AstrBot 核心开发交流群: 975206796**(AstrBot 开发成员通常活跃于此,欢迎任何对编程/AI技术感兴趣的同学加入~) 21 | 22 | ### Discord 23 | 24 | > 这个社区群组主要用于备用,并高度遵守国家法律法规,请不要发布或转发任何违反国家法律法规的信息。 25 | 26 | https://discord.gg/PxgzhmxJ 27 | 28 | ### Telegram 29 | 30 | > 这个社区群组主要用于备用,并高度遵守国家法律法规,请不要发布或转发任何违反国家法律法规的信息。 31 | 32 | https://t.me/+hAsD2Ebl5as3NmY1 33 | 34 | ### GitHub 35 | 36 | 欢迎提交 Issue 或 Pull Request: 37 | 38 | - [AstrBotDevs/AstrBot](https://github.com/AstrBotDevs/AstrBot) 39 | 40 | - [AstrBotDevs/AstrBot-Docs](https://github.com/AstrBotDevs/AstrBot-docs) 41 | 42 | ## 成为 AstrBot 组织成员 43 | 44 | 为了维护一个积极、健康和高效的社区环境,我们希望您满足以下任何一个条件: 45 | 46 | 1. **对项目有贡献** 47 | * 通过提交 **Pull Requests (PR)**、修复 **Issues** 或提供 **Bug Reports**,参与并推动项目的开发。 48 | * 贡献代码、文档、测试、或其他任何能推动项目进展的内容。 49 | 2. **遵守 AGPL-3.0 协议与社区行为准则** 50 | * 您必须阅读并同意项目的**开源许可协议**(AGPL-3.0)。 51 | * 当您以 AstrBot 组织成员的身份在公开场合参与活动时,您必须遵守 AstrBot 采用的社区行为准则:[GitHub 社区行为准则 - GitHub 文档](https://docs.github.com/zh/site-policy/github-terms/github-community-code-of-conduct) 52 | 3. **冷静应对分歧** 53 | * 在遇到社区、技术上的分歧或意见不合时,保持冷静,采取积极建设性的讨论方式,避免采取过激或攻击性的言辞——请对有其他想法和经验水平的用户持开放态度。 54 | 4. **积极参与讨论** 55 | * 在 **Issues**、**Discussions、QQ 群 **或其他社区沟通渠道中积极参与讨论,提出有价值的意见和建议。 56 | * 掌握编程技术不是硬性规定,如果您无法提供直接的代码贡献,仍可通过帮助解决问题、提供反馈或提出创意来支持社区。 57 | 5. **遵循项目的开发流程** 58 | * 在贡献代码时,遵循项目采用的代码风格(使用 PEP 8)。 59 | * 在提交改动较大的 PR 时(无论是代码还是文档),必须邀请组织其余成员进行 **Code Review**。 60 | * 保证您的提交是经过适当测试的。 61 | 7. **不得破坏社区** 62 | * 任何行为或举动(包括但不限于破坏代码、提交恶意 Pull Requests、滥用 Issue 系统等)旨在削弱或破坏项目的开发、文档、社区协作等方面的工作,都是不被允许的。 63 | * 禁止通过篡改仓库、无效 PR 或故意引发冲突等方式导致项目进度受阻或带来不必要的困扰。对于严重违规行为,管理团队有权将该成员从组织中移除,并在必要时采取法律行动。 64 | 8. **持续支持与学习** 65 | * 成为社区成员意味着你愿意**持续参与**项目并帮助其他成员,无论是通过技术支持还是其他形式的帮助。管理团队有权移除长时间未活动的成员。 66 | * 您必须对 AI 等技术具有好奇心和自我驱动力,并在开发过程中持续学习。 67 | 9. **推荐与提名** 68 | * 成员的推荐:如果您认为某个贡献者符合上述条件,可以通过组织内的团队成员或管理者进行提名。 69 | * 经过团队和社区的评估后,该贡献者可以被邀请加入组织成员名单。 70 | 71 | 成为组织成员后,您将享有以下权益: 72 | 73 | * **项目管理权限**:有权审查和合并 PR、管理 Issues、以及对项目进行结构性修改。 74 | * **社区认可**:在项目文档中标明为组织成员,展示贡献和影响力。 75 | 76 | 77 | -------------------------------------------------------------------------------- /config/astrbot-config.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | 6 | # AstrBot 配置文件 7 | 8 | AstrBot 的配置文件是一个 `Json` 格式的文件。AstrBot 会在启动时读取这个文件,并根据文件中的配置来初始化 AstrBot。 9 | 10 | 它位于 `data/cmd_config.json` 下。接下来,我们将详细介绍 AstrBot 的配置文件。 11 | 12 | 13 | AstrBot 默认配置如下: 14 | 15 | ```json 16 | { 17 | "config_version": 2, 18 | "platform_settings": { 19 | "unique_session": false, 20 | "rate_limit": { 21 | "time": 60, 22 | "count": 30, 23 | "strategy": "stall", 24 | }, 25 | "reply_prefix": "", 26 | "forward_threshold": 200, 27 | "id_whitelist": [], 28 | "wl_ignore_admin_on_group": true, 29 | "wl_ignore_admin_on_friend": true 30 | }, 31 | "provider": [], 32 | "provider_settings": { 33 | "enable": true, 34 | "wake_prefix": "", 35 | "web_search": false, 36 | "identifier": false, 37 | "datetime_system_prompt": true, 38 | "default_personality": "如果用户寻求帮助或者打招呼,请告诉他可以用 /help 查看 AstrBot 帮助。", 39 | "prompt_prefix": "" 40 | }, 41 | "content_safety": { 42 | "internal_keywords": {"enable": true, "extra_keywords": []}, 43 | "baidu_aip": {"enable": false, "app_id": "", "api_key": "", "secret_key": ""} 44 | }, 45 | "admins_id": [], 46 | "t2i": false, 47 | "http_proxy": "", 48 | "dashboard": { 49 | "enable": true, 50 | "username": "astrbot", 51 | "password": "77b90590a8945a7d36c963981a307dc9" 52 | }, 53 | "platform": [], 54 | "wake_prefix": ["/"], 55 | "log_level": "INFO", 56 | "t2i_endpoint": "", 57 | "pip_install_arg": "", 58 | "plugin_repo_mirror": "" 59 | } 60 | ``` 61 | 62 | ## 字段 63 | 64 | ### `config_version` 65 | 66 | 配置文件版本。请勿修改。 67 | 68 | ### `platform` 69 | 70 | 一个列表,存储了 AstrBot 的消息平台适配器配置。当前,AstrBot 默认支持的消息平台适配器有 `aiocqhttp`、`qqofficial`、`vchat`。如果你想通过修改配置文件的方式新增消息平台适配器,可以根据需要复制下面的配置并添加到这个列表中。 71 | 72 | 由于配置较多,具体配置请参考 [消息平台适配器](/others/platform)。 73 | 74 | > [!TIP] 75 | > 如果你不会 Json 语法,可以使用在线的 [Json 编辑器](https://jsoneditoronline.org/) 来编辑配置文件。当有语法错误,会有提示。 76 | 77 | 78 | 79 | ### `platform_settings` 80 | 81 | 消息平台适配器的通用设置。 82 | 83 | - `unique_session`: 是否启用唯一会话。默认为 `false`。启用后,在群组或者频道中,每个人的消息上下文都是独立的。 84 | 85 | - `rate_limit`: 当消息速率超过限制时的处理策略。`time` 为时间窗口,`count` 为消息数量,`strategy` 为限制策略。`stall` 为等待,`discard` 为丢弃。 86 | 87 | - `reply_prefix`: 回复消息时的固定前缀字符串。默认为空。 88 | 89 | - `forward_threshold`: 消息转发阈值。当回复内容超过一定字数后,机器人会将消息折叠成 QQ 群聊的 “转发消息”,以防止刷屏。目前仅 QQ 平台适配器适用。 90 | 91 | - `id_whitelist`: ID 白名单。填写后,将只处理所填写的 ID 发来的消息事件。为空时表示不启用白名单过滤。可以使用 /myid 指令获取在某个平台上的会话 ID。也可在 AstrBot 日志内获取会话 ID,当一条消息没通过白名单时,会输出 INFO 级别的日志。会话 ID 类似 aiocqhttp:GroupMessage:547540978 92 | 93 | - `wl_ignore_admin_on_group`: 是否管理员发送的群组消息无视 ID 白名单。默认为 `true`。 94 | 95 | - `wl_ignore_admin_on_friend`: 是否管理员发送的私聊消息无视 ID 白名单。默认为 `true`。 96 | 97 | - `path_mapping`: 路径映射。此功能解决由于文件系统不一致导致路径不存在的问题。格式为 <原路径>:<映射路径>。如 `/app/.config/QQ:/var/lib/docker/volumes/xxxx/_data/`。这样,当消息平台下发的事件中图片和语音路径以 `/app/.config/QQ` 开头时,被替换为 `/var/lib/docker/volumes/xxxx/_data/`。这在 AstrBot 或者平台协议端使用 Docker 部署时特别有用。 98 | 99 | 情况一:由于某些平台协议端(如 Napcat)在 Docker 部署时,下发的语音数据中的路径是其容器内部的文件系统的路径,使得 AstrBot 无法直接获取到。 100 | 101 | 情况二:如果您使用 Docker 部署 AstrBot,使得 AstrBot 无法访问宿主机文件系统或者无法访问同样使用 Docker 部署的协议端的文件系统 102 | 103 | 如果遇到这两种情况可以使用此功能。 104 | 105 | 对于情况一: 106 | 107 | 首先,请记录其输出的路径的开头(可以开启 DEBUG 模式找到,或者先直接请求一遍,查看黄色的路径未找到的警告),对于 Napcat 的语音,是 `/app/.config/QQ`。 108 | 109 | 然后,docker run 添加参数 `-v <想要映射的宿主机的路径>:<路径开头>`。这一步的目的是将容器内的指定目录映射到宿主机的指定目录下,这使得 AstrBot 访问其数据成为可能。 110 | 111 | 然后,在 `path_mapping` 处添加:`<路径开头>:<想要映射的宿主机的路径>”` 即可。 112 | 113 | 对于情况二: 114 | 115 | 目的也是一样的,我们要让双方基于宿主机文件系统进行交流。 116 | 117 | AstrBot Docker 在启动时,将 `data` 目录映射到了宿主机的 `/data` 目录下。 118 | 119 | 因此,协议端的 docker run 添加参数 `-v /data/temp/<自定义目录名>:<路径开头>` 即可。在此之前您可能需要手动在 `/data/temp/` 下创建这个自定义的目录。 120 | 121 | 然后,在 `path_mapping` 处添加:`<路径开头>:/data/temp/<自定义目录名>”` 即可。 122 | 123 | 124 | > [TIP] 125 | > 请注意,ubuntu 系通过源码运行的用户如果映射到宿主机的 /root 目录下,请保证astrbot 有sudo权限 126 | 127 | 128 | 如果您有 Docker 相关知识,会更好理解以上文本。如果难以理解,可以提交 ISSUE(推荐) 或者加社区群询问。 129 | 130 | ### `provider` 131 | 132 | 和 `platform` 一样也是一个列表,存储了大语言模型提供商的配置。 133 | 134 | 由于配置较多,具体配置请参考 [大语言模型提供商](/others/provider)。 135 | 136 | > [!TIP] 137 | > 使用 `/provider` 指令可以查看、切换大语言模型提供商。 138 | > 139 | > 使用 `/model` 指令可以查看、切换提供商支持的模型。(需要提供商适配) 140 | 141 | 142 | ### `provider_settings` 143 | 144 | 大语言模型提供商的通用设置。 145 | 146 | - `enable`: 是否启用大语言模型聊天。默认为 `true`。 147 | - `wake_prefix`: 使用 LLM 聊天额外的触发条件。如填写 `chat`,则需要发送消息时要以 `/chat` 才能触发 LLM 聊天。其中 `/` 是机器人的唤醒前缀。是一个防止滥用的手段。 148 | - `web_search`: 是否启用 Web 搜索。默认为 `false`。启用后,LLM 可能会自动搜索网页并根据内容回答。能访问 Google 时效果最佳。如果 Google 访问失败,程序会依次访问 Bing, Sogo 搜索引擎。 149 | - `identifier`: 在 Prompt 前加上群成员的名字以让模型更好地了解群聊状态。启用将略微增加 token 开销。 150 | - `datetime_system_prompt`: 启用后,会在系统提示词中加上当前机器的日期时间。 151 | - `default_personality`: 默认人格(情境设置/System Prompt)文本。也可以使用 `/persona` 指令来切换人格。 152 | - `prompt_prefix`: 添加之后,会在每次对话的 Prompt 前加上此文本。默认为空。 153 | 154 | ### `content_safety` 155 | 156 | 内容安全设置。 157 | 158 | - `internal_keywords`: 内部关键词检测。`enable` 是否启用内部关键词检测。`extra_keywords` 额外的关键词列表。**支持正则表达式。** 159 | - `baidu_aip`: 百度 AI 内容审核。`enable` 是否启用百度 AI 内容审核。`app_id`, `api_key`, `secret_key` 为百度 AI 内容审核的配置。 160 | 161 | > [!TIP] 162 | > 如果要启用百度 AI 内容审核,请先 `pip install baidu-aip`。 163 | 164 | ### `admins_id` 165 | 166 | 管理员 ID 列表。此外,还可以使用 `/op`, `/deop` 指令来添加或删除管理员。 167 | 168 | > [!TIP] 169 | > aiocqhttp 的管理员 ID 是 QQ 号。 170 | 171 | ### `t2i` 172 | 173 | 启用后,超出一定长度的文本将会通过 AstrBot API 渲染成 Markdown 图片发送。可以缓解审核和消息过长刷屏的问题,并提高 Markdown 文本的可读性。 174 | 175 | ### `http_proxy` 176 | 177 | HTTP 代理。如 `http://localhost:7890`。 178 | 179 | ### `dashboard` 180 | 181 | 请不要随意修改 `password` 的值。它是一个经过 `md5` 加密的密码。请在控制面板修改密码。 182 | 183 | ### `wake_prefix` 184 | 185 | 唤醒前缀。默认为 `/`。当消息以 `/` 开头时,AstrBot 会被唤醒。 186 | 187 | > [!TIP] 188 | > 还需要在白名单中。 189 | 190 | ### `log_level` 191 | 192 | 日志级别。默认为 `INFO`。可以设置为 `DEBUG`, `INFO`, `WARNING`, `ERROR`, `CRITICAL`。 193 | 194 | ### `t2i_endpoint` 195 | 196 | AstrBot API 的地址。用于渲染 Markdown 图片。 197 | 198 | ### `pip_install_arg` 199 | 200 | `pip install` 的参数。如 `-i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple`。 201 | 202 | ### `plugin_repo_mirror` 203 | 204 | GitHub 仓库镜像。用于加速安装插件、AstrBot 更新。在控制面板中提供了可选项。 205 | -------------------------------------------------------------------------------- /config/model-config.md: -------------------------------------------------------------------------------- 1 | 2 | # 配置自定义的模型参数 3 | 4 | AstrBot 的配置文件是一个 `Json` 格式的文件。AstrBot 会在启动时读取这个文件,并根据文件中的配置来初始化 AstrBot。它位于 `data/cmd_config.json` 下。 5 | 6 | 模型配置可以手动修改配置文件修改。 7 | 8 | 您可在管理面板在线修改配置文件: 9 | 10 | ![](../source/images/model-config/image.png) 11 | 12 | 也可以手动修改位于 `data/cmd_config.json` 下的配置文件。 13 | 14 | 找到 `provider`,并找到你想要修改的提供商的模型配置: 15 | 16 | ![alt text](../source/images/model-config/image-2.png) 17 | 18 | 然后在 `model_config` 中添加新的参数即可。 19 | 20 | 具体的参数请看对应的提供商的文档。 -------------------------------------------------------------------------------- /config/providers/dashscope.md: -------------------------------------------------------------------------------- 1 | # 接入阿里云百炼应用 2 | 3 | 在 v3.4.30 及之后,AstrBot 支持接入阿里云百炼应用。 4 | 5 | ## 使用 6 | 7 | 在 [阿里云百炼应用](https://bailian.console.aliyun.com/app-center#/app-center) 官网点击新增应用,根据自己的需要创建智能体应用或者工作流应用或者智能体编排应用,并且按照自己的需求构建好智能体或者工作流。 8 | 9 | 记录应用ID: 10 | 11 | ![](../../source/images/dashscope/image-1.png) 12 | 13 | 点击进入应用,点击发布渠道->API 调用->API KEY,创建并且复制 API KEY: 14 | 15 | ![alt text](../../source/images/dashscope/image-2.png) 16 | 17 | 进入 AstrBot 管理面板->服务提供商->新增服务提供商->Dashscope,进入配置页面。 18 | 19 | ![](../../source/images/dashscope/image.png) 20 | 21 | 根据阿里云百炼应用,一共有四种应用类型,分别是 22 | 23 | - 智能体应用(agent) 24 | - 任务型工作流应用(task-workflow) 25 | - 对话型工作流应用(dialog-workflow) 26 | - 智能体编排应用(agent-arrange) 27 | 28 | > [!TIP] 29 | > 多轮对话仅支持智能体应用和对话型工作流应用。AstrBot 会自动为这两种应用附上对话历史记录以支持多轮对话。 30 | 31 | 请保证 AstrBot 里配置的 `应用类型` 和阿里云百炼应用里创建的应用类型一致。 32 | 33 | 然后将应用 ID 填写到 `dashscope_app_id`,API KEY 填写到 `dashscope_api_key`。 34 | 35 | 填写完这三项之后点击保存。 36 | 37 | 可以在聊天页进行测试: 38 | 39 | ![](../../source/images/dashscope/image-3.png) 40 | 41 | ## 在聊天时动态设置输入变量 42 | 43 | 对于两种工作流应用,可在聊天区动态设置输入的变量。 44 | 45 | 使用 `/set` 指令可以动态设置输入变量,如下图所示: 46 | 47 | ![alt text](../../source/images/dify/image-5.png) 48 | 49 | 当设置变量后,AstrBot 会在下次向阿里云百炼应用请求时附上您设置的变量,以灵活适配您的 Workflow。 50 | 51 | 当然,可以使用 `/unset` 指令来取消您所设置的变量。如 `/unset name` 52 | 53 | 变量在当前会话永久有效。 54 | 55 | > 变量存储在 data/shared_preferences.json 下。 -------------------------------------------------------------------------------- /config/providers/dify.md: -------------------------------------------------------------------------------- 1 | # 接入 Dify 2 | 3 | 在 v3.4.2 及之后,AstrBot 支持接入 Dify LLMOps 平台以增强本项目的功能。 4 | 5 | ## 安装 Dify 6 | 7 | 如果您还没有安装 Dify,请参考 [Dify 安装文档](https://docs.dify.ai/zh-hans/getting-started/install-self-hosted) 安装。 8 | 9 | ## 使用 10 | 11 | 如下图,点击 `dify`,即可创建一个适用于 Dify 的 Provider。 12 | 13 | ![](../../source/images/provider/image.png) 14 | 15 | 创建后,如下图所示: 16 | 17 | ![](../../source/images/dify/image.png) 18 | 19 | 在 Dify 中,一个 `API Key` 唯一对应一个 Dify 应用。因此,您可以创建多个 Provider 以适配多个 Dify 应用。 20 | 21 | 根据目前的 Dify 项目,一共有三种类型,分别是: 22 | 23 | - chat 24 | - agent 25 | - workflow 26 | 27 | 请确保你在 AstrBot 里设置的 APP 类型和 Dify 里面创建的应用的类型一致!!! 28 | 29 | ![](../../source/images/dify/image-3.png) 30 | 31 | 对于 Workflow 应用,AstrBot 在每次请求时会附上两个变量: 32 | 33 | - `astrbot_text_query`: 用户输入的`文本内容` 34 | - `astrbot_session_id`: 会话 ID 35 | 36 | 因此您需要修改您的 Workflow 的输入的变量名以适配 AstrBot 的输入。 37 | 38 | ![](../../source/images/dify/image-1.png) 39 | 40 | 您可以自定义 Workflow 输出的内容对应的变量名,在上图中可看到并可配置。设置好变量名后,您需要修改您的 Workflow 的输出的变量名以让 AstrBot 正确解析。 41 | 42 | ![](../../source/images/dify/image-2.png) 43 | 44 | 45 | ## 在聊天时动态设置输入变量 46 | 47 | 使用 `/set` 指令可以动态设置输入变量,如下图所示: 48 | 49 | ![alt text](../../source/images/dify/image-5.png) 50 | 51 | 当设置变量后,AstrBot 会在下次向 Dify 请求时附上您设置的变量,以灵活适配您的 Workflow。 52 | 53 | ![alt text](../../source/images/dify/image-4.png) 54 | 55 | 当然,可以使用 `/unset` 指令来取消设置的变量。 56 | 57 | 变量在当前会话永久有效。 58 | 59 | > 变量存储在 data/shared_preferences.json 下。 -------------------------------------------------------------------------------- /config/providers/llm.md: -------------------------------------------------------------------------------- 1 | # 大语言模型提供商 2 | 3 | 你可在管理面板->服务提供商->+新增服务提供商 处配置各种大语言模型服务。 4 | 5 | > [!TIP] 6 | > 如果没有你希望接入的模型服务,你可以试着查看您希望接入的服务提供商处是否支持 兼容 OpenAI API,如果支持,那么你可以选择上面截图中的第一项 `OpenAI` 然后通过修改 API Base URL 的方式接入。 7 | 8 | ![](../../source/images/llm/image.png) 9 | 10 | ![](../../source/images/llm/image-1.png) 11 | 12 | 13 | > 相应的配置保存在 `data/cmd_config.json` 的 `provider` 字段中。 -------------------------------------------------------------------------------- /config/providers/oneapi.md: -------------------------------------------------------------------------------- 1 | # 接入 OneAPI 2 | 3 | OneAPI 使得我们能通过标准的 OpenAI API 格式访问全球几乎所有厂商的所有大模型,并且做到了开箱即用。 4 | 5 | ``` 6 | OpenAI ChatGPT 系列模型(支持 Azure OpenAI API) 7 | Anthropic Claude 系列模型 (支持 AWS Claude) 8 | Google PaLM2/Gemini 系列模型 9 | Mistral 系列模型 10 | 字节跳动豆包大模型 11 | 百度文心一言系列模型 12 | 阿里通义千问系列模型 13 | 讯飞星火认知大模型 14 | 智谱 ChatGLM 系列模型 15 | 360 智脑 16 | 腾讯混元大模型 17 | Moonshot AI 18 | 百川大模型 19 | MINIMAX 20 | Groq 21 | Ollama 22 | 零一万物 23 | 阶跃星辰 24 | Coze 25 | Cohere 26 | DeepSeek 27 | Cloudflare Workers AI 28 | DeepL 29 | together.ai 30 | novita.ai 31 | ``` 32 | 33 | 它是一个开源项目,你可以在 [这里](https://github.com/songquanpeng/one-api) 找到它。 34 | 35 | ## 部署 OneAPI 36 | 37 | 请参阅 [OneAPI 部署文档](https://github.com/songquanpeng/one-api?tab=readme-ov-file#%E9%83%A8%E7%BD%B2)。 38 | 39 | > [!TIP] 40 | > 使用 Docker 部署非常方便。 41 | 42 | 在部署完之后,打开 OneAPI 后台面板(如果你没改端口,端口默认是 3000),使用默认账户`root` 密码 `123456` 登录管理员账号。 43 | 44 | 然后,点击渠道,添加相关信息。 45 | 46 | ![](../../source/images/oneapi/image-1.png) 47 | 48 | > [!TIP] 49 | > 如果对应的渠道需要代理,请在下面添加代理。 50 | 51 | 添加成功后,点击 `令牌`,添加一个令牌。模型范围需要选择刚刚添加的渠道。 52 | 53 | 添加成功后,再次点击 `令牌`,点击 `复制`。如果复制失败,请手动复制。 54 | 55 | > [!TIP] 56 | > 请关注你创建好的令牌的剩余额度。 57 | 58 | 接着,打开 AstrBot 可视化面板,点击 `配置` -> `大语言模型` 添加一个 `OpenAI` 类型。 59 | 60 | ![](../../source/images/oneapi/image.png) 61 | 62 | 修改 API Base URL: `http://localhost:3000/v1`。(如果你在云服务器上部署了 OneAPI,那么请填写你的公网地址) 63 | 64 | 模型填写你所添加的模型名称,比如 `gpt-4o-mini`. -------------------------------------------------------------------------------- /config/providers/ppio.md: -------------------------------------------------------------------------------- 1 | # 接入 PPIO 派欧云 2 | 3 | PPIO 派欧云是中国领先的独立分布式云计算服务商,您可以在派欧云上使用稳定、低价甚至免费的模型服务。 4 | 5 | ## 准备 6 | 7 | 打开 [PPIO 派欧云官网](https://ppio.cn/user/register?invited_by=AIOONE),并注册账户(通过此链接注册的账户将会获得 15 元人民币的代金券)。 8 | 9 | 进入 [模型 API 服务](https://ppio.cn/model-api/console),找到你想接入的模型。你可以通过筛选器选择不同厂商或者免费的模型。 10 | 11 | ![](../../source/images/ppio/image-1.png) 12 | 13 | 找到你想要接入的模型后,点击模型卡片,侧边会展开一个模型详情卡片,找到下方的 API 接入指南,如果您还没创建过 Key 可以点击创建。 14 | 15 | ![](../../source/images/ppio/image-3.png) 16 | 17 | 打开 AstrBot 控制台 -> 服务提供商页面,点击新增提供商,找到并点击 `PPIO派欧云`(需要版本 >= 3.5.10,旧版本也可使用,见下文)。 18 | 19 | ![](../../source/images/ppio/image.png) 20 | 21 | 将 API Key 和模型名称填入对话框表单,点击保存,即可完成创建。 22 | 23 | > [!TIP] 24 | > 如果您是 AstrBot 旧版本(< 3.5.10)的用户,请打开 AstrBot 控制台 -> 服务提供商页面,点击新增提供商,找到 `OpenAI`,点击进入。 25 | > 1. 将 ID 命名为 `ppio`(随意) 26 | > 2. 然后将 `API Base URL` 设置为 `https://api.ppinfra.com/v3/openai` 27 | > 3. 然后将 API Key 和模型名称填入对话框表单,点击保存,即可完成创建。 28 | 29 | 30 | ## 使用 31 | 32 | 对机器人输入 `/provider` 指令,将提供商切换到刚刚添加的 PPIO 派欧云提供商,即可使用。 33 | 34 | ## 常见问题 35 | 36 | #### Error code: 400 - {'code': 400, 'message': '"auto" tool choice requires --enable-auto-tool-choice and --tool-call-parser to be set', 'type': 'BadRequestError'} 37 | 38 | 请暂时使用 `/tool off_all` 禁用所有的函数调用工具即可使用,或者换用其他模型。 -------------------------------------------------------------------------------- /config/providers/provider-lmstudio.md: -------------------------------------------------------------------------------- 1 | # 接入 LM Studio 使用 DeepSeek-R1 等模型 2 | 3 | LMStudio 允许在本地电脑上部署模型(需要电脑硬件配置符合要求) 4 | 5 | ### 下载并安装 LMStudio 6 | 7 | https://lmstudio.ai/download 8 | 9 | ### 下载并运行模型 10 | 11 | https://lmstudio.ai/models 12 | 13 | 跟随 LMStudio 下载并运行想要的模型,如 deepseek-r1-qwen-7b: 14 | 15 | ```bash 16 | lms get deepseek-r1-qwen-7b 17 | ``` 18 | 19 | ### 配置 AstrBot 20 | 21 | 在 AstrBot 上: 22 | 23 | 点击 配置->服务提供商配置->加号->openai 24 | 25 | API Base URL 填写 `http://localhost:1234/v1` 26 | 27 | API Key 填写 `lm-studio` 28 | 29 | > 对于 Mac/Windows 使用 Docker Desktop 部署 AstrBot 部署的用户,API Base URL 请填写为 `http://host.docker.internal:1234/v1`。 30 | > 对于 Linux 使用 Docker 部署 AstrBot 部署的用户,API Base URL 请填写为 `http://172.17.0.1:1234/v1`,或者将 `172.17.0.1` 替换为你的公网 IP IP(确保宿主机系统放行了 1234 端口)。 31 | 32 | 如果 LM Studio 使用了 Docker 部署,请确保 1234 端口已经映射到宿主机。 33 | 34 | 模型名填写上一步选好的 35 | 36 | 保存配置即可。 37 | 38 | > 输入 /provider 查看 AstrBot 配置的模型 -------------------------------------------------------------------------------- /config/providers/provider-ollama.md: -------------------------------------------------------------------------------- 1 | # Integrating Ollama 2 | 3 | 🦙 Ollama is a free, open-source tool that lets you run large language models (LLMs) on your own computer. (hardwares must meet requirements). 4 | 5 | ## Download and Install Ollama 6 | 7 | You can download `Ollama` in [https://ollama.com/](https://ollama.com/) 8 | 9 | ## Select and Pull a Model 10 | 11 | * Choose the model you want to use at [https://ollama.com/search](https://ollama.com/search) or HuggingFace. 12 | * In the terminal (PowerShell on Windows), enter `ollama pull ` to download the model. 13 | * `model_name` format: `:`. For example, `deepseek-r1:8b`. 14 | * The 8b parameter model requires at least 16GB of video memory (VRAM). Refer to other documentation for detailed information on configurations and parameter sizes. 15 | * After pulling is complete, use `ollama list` to view the models you have pulled. 16 | * Then use `ollama run ` to run the model. 17 | 18 | ## Configure AstrBot 19 | 20 | * In AstrBot: 21 | * ![image](https://github.com/user-attachments/assets/5f55556f-0278-4350-82b3-c430d855c6bb) 22 | 23 | * Save the configuration. 24 | * Enter `/provider` to view the models configured in AstrBot. 25 | * For Mac/Windows users deploying AstrBot with Docker Desktop, enter `http://host.docker.internal:11434/v1` for the API Base URL. 26 | * For Linux users deploying AstrBot with Docker, enter `http://172.17.0.1:11434/v1` for the API Base URL, or replace `172.17.0.1` with your public IP address (ensure that port 11434 is allowed by the host system). 27 | * If LM Studio is deployed using Docker, ensure that port 11434 is mapped to the host. 28 | 29 | ## FAQ 30 | 31 | * Error: 32 | * `AstrBot request failed.` 33 | * `Error type: NotFoundError` 34 | * `Error message: Error code: 404 - {'error': {'message': 'model "llama3.1-8b" not found, try pulling it first', 'type': 'api_error', 'param': None, 'code': None}}` 35 | * Please refer to the instructions above and use `ollama pull ` to pull the model. 36 | * Then use `ollama run ` to run the model. 37 | 38 | 39 | # 接入 Ollama 使用 DeepSeek-R1 等模型 40 | 41 | Ollama 允许在本地电脑上部署模型(需要电脑硬件配置符合要求) 42 | 43 | ### 下载并安装 Ollama 44 | 45 | https://ollama.com/ 46 | 47 | ### 选择想要使用的模型 48 | 49 | 在 https://ollama.com/search 上选择想要使用的模型。 50 | 51 | 在终端上(windows 是 powershell)输入 `ollama pull ` 下载模型。 52 | 53 | model_name 格式:`:`。如 `deepseek-r1:8b`。 54 | 55 | > 8b 参数量模型需要至少 16GB 显存。有关配置和参数量的详细信息,请参阅其他文档。 56 | 57 | 拉取完成后,`ollama list` 查看已经拉取的模型。 58 | 59 | 然后使用 `ollama run ` 运行模型。 60 | 61 | ### 配置 AstrBot 62 | 63 | 在 AstrBot 上: 64 | 65 | ![image](https://github.com/user-attachments/assets/5f55556f-0278-4350-82b3-c430d855c6bb) 66 | 67 | 保存配置即可。 68 | 69 | > 输入 /provider 查看 AstrBot 配置的模型 70 | 71 | > 对于 Mac/Windows 使用 Docker Desktop 部署 AstrBot 部署的用户,API Base URL 请填写为 `http://host.docker.internal:11434/v1`。 72 | > 对于 Linux 使用 Docker 部署 AstrBot 部署的用户,API Base URL 请填写为 `http://172.17.0.1:11434/v1`,或者将 `172.17.0.1` 替换为你的公网 IP IP(确保宿主机系统放行了 11434 端口)。 73 | 74 | 如果 LM Studio 使用了 Docker 部署,请确保 11434 端口已经映射到宿主机。 75 | 76 | 77 | ### FAQ 78 | 79 | 报错: 80 | ``` 81 | AstrBot 请求失败。 82 | 错误类型: NotFoundError 83 | 错误信息: Error code: 404 - {'error': {'message': 'model "llama3.1-8b" not found, try pulling it first', 'type': 'api_error', 'param': None, 'code': None}} 84 | ``` 85 | 86 | 请先看上面的教程,用 `ollama pull ` 拉取模型。 87 | 88 | 然后使用 `ollama run ` 运行模型。 89 | -------------------------------------------------------------------------------- /deploy/astrbot/btpanel.md: -------------------------------------------------------------------------------- 1 | # 在 宝塔面板 部署 AstrBot 2 | 3 | [宝塔面板](https://www.bt.cn/new/index.html)是一个安全高效、生产可用的 Linux/Windows 服务器运维面板。 4 | 5 | AstrBot 已经上架至宝塔的 Docker 应用商店,支持一键安装。 6 | 7 | ## 安装宝塔面板 8 | 9 | 如果您还没有安装宝塔面板,请参考 [安装宝塔产品](https://www.bt.cn/new/download.html) 一键安装。 10 | 11 | ## 设置加速 URL(国内服务器用户) 12 | 13 | 进入宝塔面板页面后,点击左侧的 `Docker`,点击设置,修改`加速 URL`。 14 | 15 | ![alt text](../../source/images/btpanel/image-1.png) 16 | 17 | ## 安装 AstrBot 18 | 19 | 进入 Docker 的应用商店,搜索 `AstrBot`,如下图所示。 20 | 21 | ![](../../source/images/btpanel/image.png) 22 | 23 | 点击安装,等待安装成功。 24 | 25 | 安装成功后,点击左侧 `安全`,放行对应的 AstrBot 端口(默认是 6185 端口)。 26 | 27 | 如果您正在使用 AWS、阿里云、腾讯云等厂商的云服务器,请确保其安全组也放行了对应的端口。 28 | 29 | ## 访问 AstrBot 30 | 31 | 访问 `http://IP:6185` 即可访问 AstrBot 的管理面板。 32 | 33 | > [!TIP] 34 | > 默认情况下,上述方法只会放行一个 6185 端口。如果需要部署消息平台,需要额外放行对应的端口。点击上栏 `容器`,找到 AstrBot 容器,点击 `管理`,点击 `编辑容器`,添加对应的端口即可。 35 | > 36 | > ![](../../source/images/btpanel/image-2.png) 37 | > 38 | > 具体的消息平台对应端口可以参考下表: 39 | > 40 | >| 端口 | 描述 | 类型 41 | >| -------- | ------- | ------- | 42 | >| 6185 | AstrBot WebUI `默认` 端口 | 需要 | 43 | >| 6195 | 企业微信 `默认` 端口 | 可选 | 44 | >| 6199 | QQ 个人号(aiocqhttp) `默认` 端口 | 可选 | 45 | >| 6196 | QQ 官方接口(Webhook) `默认` 端口 | 可选 | 46 | >| 11451 | 微信个人号(gewechat) `默认` 端口 | 可选 | 47 | > 48 | > 没有列举的平台表示不需要额外放行端口。 49 | 50 | -------------------------------------------------------------------------------- /deploy/astrbot/casaos.md: -------------------------------------------------------------------------------- 1 | # 在 CasaOS 部署 AstrBot 2 | 3 | ## 安装 CasaOS 4 | 5 | ```bash 6 | curl -fsSL https://get.casaos.io | sudo bash 7 | ``` 8 | 9 | ## 添加 CasaOS-AppStore-Play 应用商店源 10 | 11 | ![](../../source/images/casaos/image.png) 12 | 13 | 点击 `更多应用`,然后输入: 14 | 15 | ```txt 16 | https://play.cuse.eu.org/Cp0204-AppStore-Play.zip 17 | ``` 18 | 19 | 并添加,等待添加完成。 20 | 21 | 如果您的网络环境在国内,请先搜索并添加 `dkTurbo`,否则可能无法拉取 AstrBot 镜像。 22 | 23 | ![](../../source/images/casaos/image-1.png) 24 | 25 | 输入 `Astrbot` 即可找到 AstrBot。 26 | 27 | ![](../../source/images/casaos/image-2.png) 28 | 29 | 点击图标(不是安装按钮),然后悬浮到`安装`按钮上,点击自定义安装。 30 | 31 | ![](../../source/images/casaos/image-3.png) 32 | 33 | 在网络一栏选择 `host`。 34 | 35 | ![](../../source/images/casaos/image-4.png) 36 | 37 | 然后点击`安装`开始安装。 38 | 39 | 安装完成后,主界面会出现 AstrBot APP,点击即可打开管理面板。 -------------------------------------------------------------------------------- /deploy/astrbot/cli.md: -------------------------------------------------------------------------------- 1 | # 通过源码部署 AstrBot 2 | 3 | > [!WARNING] 4 | > 你正在直接通过源码来部署本项目,该教程需要您具有一定的技术基础。 5 | > 6 | > 以下教程默认您的设备上已经安装 Python,并且版本 `>=3.10` 7 | 8 | 9 | ## 下载/克隆仓库 10 | 11 | 如果你的电脑上安装了 `git`,你可以通过以下命令来下载源码: 12 | 13 | ```bash 14 | git clone http://github.com/Soulter/AstrBot 15 | cd AstrBot 16 | ``` 17 | 18 | 如果你没有安装 `git`,请先下载安装。 19 | 20 | 或者,直接从 GitHub 上下载源码解压: 21 | 22 | ![](../../source/images/cli/image.png) 23 | 24 | ## 安装依赖并运行 25 | 26 | ::: details 【🥳推荐】使用 `uv` 管理依赖 27 | 28 | > 如果没安装 `uv`,请参考 [Installing uv](https://docs.astral.sh/uv/getting-started/installation/) 安装。 29 | 30 | 2. 在终端执行(AstrBot 目录下) 31 | ```bash 32 | uv sync 33 | uv run main.py 34 | ``` 35 | ::: 36 | 37 | ::: details Python 内置 venv 安装依赖 38 | 39 | 在 AstrBot 源码目录下,使用终端运行以下命令: 40 | 41 | > 如果是 Windows,直接下载源码解压的,请打开解压的文件夹,在地址栏输入: 42 | > ![](../../source/images/cli/image-1.png) 43 | 44 | ```bash 45 | python3 -m venv ./venv 46 | ``` 47 | 48 | > 也可能是 `python` 而不是 `python3` 49 | 50 | 以上步骤会创建一个虚拟环境并激活(以免打乱您设备本地的 Python 环境)。 51 | 52 | 接下来,通过以下命令安装依赖文件,这可能需要花费一些时间: 53 | 54 | Mac/Linux/WSL 执行: 55 | 56 | ```bash 57 | source venv/bin/activate 58 | python -m pip install -r requirements.txt -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple 59 | python main.py 60 | ``` 61 | 62 | Windows 执行: 63 | 64 | ```bash 65 | venv\Scripts\activate 66 | python -m pip install -r requirements.txt -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple 67 | python main.py 68 | ``` 69 | ::: 70 | 71 | 72 | ## 🎉 大功告成! 73 | 74 | 如果一切顺利,你会看到 AstrBot 打印出的日志。 75 | 76 | 如果没有报错,你会看到一条日志显示类似 `🌈 管理面板已启动,可访问` 并附带了几条链接。打开其中一个链接即可访问 AstrBot 管理面板。链接是 `http://localhost:6185`。 77 | 78 | > [!TIP] 79 | > 如果你正在服务器上部署 AstrBot,需要将 `localhost` 替换为你的服务器 IP 地址。 80 | > 81 | > 默认用户名和密码是 `astrbot` 和 `astrbot`。 82 | 83 | 84 | 接下来,你需要部署任何一个消息平台,才能够实现在消息平台上使用 AstrBot。 85 | -------------------------------------------------------------------------------- /deploy/astrbot/docker.md: -------------------------------------------------------------------------------- 1 | # 使用 Docker 部署 AstrBot 2 | 3 | > [!WARNING] 4 | > 通过 Docker 可以方便地将 AstrBot 部署到 Windows, Mac, Linux 上。 5 | > 6 | > 以下教程默认您的环境已安装 Docker。如果没有安装,请参考 [Docker 官方文档](https://docs.docker.com/get-docker/) 进行安装。 7 | 8 | ## 通过 Docker Compose 部署 9 | 10 | ::: details 和 NapCatQQ 一起部署 11 | 12 | 如果您想使用 NapCat 将 AstrBot **部署到 QQ(个人号)**,使用这种方式会同时部署 AstrBot 和 NapCat,更快。 13 | 14 | ```bash 15 | mkdir astrbot 16 | wget https://raw.githubusercontent.com/NapNeko/NapCat-Docker/main/compose/astrbot.yml 17 | sudo docker compose -f astrbot.yml up -d 18 | ``` 19 | 20 | ::: 21 | 22 | ::: details 只部署 AstrBot(通用方式) 23 | 24 | 首先,需要 Clone AstrBot 仓库到本地: 25 | 26 | ```bash 27 | git clone https://github.com/AstrBotDevs/AstrBot 28 | cd AstrBot 29 | ``` 30 | 31 | 然后,运行 Compose: 32 | 33 | ```bash 34 | sudo docker compose up -d 35 | ``` 36 | 37 | > [!TIP] 38 | > 如果您的网络环境在中国大陆境内,上述命令将无法正常拉取。您可能需要修改 compose.yml 文件,将其中的 `image: soulter/astrbot:latest` 替换为 `image: m.daocloud.io/docker.io/soulter/astrbot:latest`。 39 | ::: 40 | 41 | ## 通过 Docker 部署 42 | 43 | ```bash 44 | mkdir astrbot 45 | sudo docker run -itd -p 6180-6200:6180-6200 -p 11451:11451 -v $PWD/data:/AstrBot/data -v /etc/localtime:/etc/localtime:ro -v /etc/timezone:/etc/timezone:ro --name astrbot soulter/astrbot:latest 46 | ``` 47 | 48 | > [!TIP] 49 | > 如果您的网络环境在中国大陆境内,上述命令将无法正常拉取。请使用以下命令拉取镜像: 50 | > 51 | > ```bash 52 | > sudo docker run -itd -p 6180-6200:6180-6200 -p 11451:11451 -v $PWD/data:/AstrBot/data -v /etc/localtime:/etc/localtime:ro -v /etc/timezone:/etc/timezone:ro --name astrbot m.daocloud.io/docker.io/soulter/astrbot:latest 53 | > ``` 54 | > 55 | > (感谢 DaoCloud ❤️) 56 | 57 | 关于端口映射,如果您不想映射上面这么多端口,可以参考下表: 58 | 59 | | Port | Description | Type 60 | | -------- | ------- | ------- | 61 | | 6185 | AstrBot WebUI `默认` 端口 | 需要 | 62 | | 6195 | 企业微信 `默认` 端口 | 可选 | 63 | | 6199 | OneBot(aiocqhttp) `默认` 端口 | 可选 | 64 | | 6196 | QQ 官方 API(Webhook) HTTP callback server `默认` 端口 | 可选 | 65 | | 11451 | Gewechat callback HTTP server `默认` 端口 | 可选 | 66 | 67 | > Windows 下不需要加 sudo,下同 68 | > Windows 同步 Host Time(需要WSL2) 69 | 70 | ``` 71 | -v \\wsl.localhost\(your-wsl-os)\etc\timezone:/etc/timezone:ro 72 | -v \\wsl.localhost\(your-wsl-os)\etc\localtime:/etc/localtime:ro 73 | ``` 74 | 75 | 通过以下命令查看 AstrBot 的日志: 76 | 77 | ```bash 78 | sudo docker logs -f astrbot 79 | ``` 80 | 81 | > [!TIP] 82 | > AstrBot 支持基于 Docker 的沙箱代码执行器。如果你需要使用沙箱代码执行器,请额外添加 `-v /var/run/docker.sock:/var/run/docker.sock` 参数。即: 83 | > 84 | > ```bash 85 | > sudo docker run -itd -p 6180-6200:6180-6200 -p 11451:11451 -v $PWD/data:/AstrBot/data -v /var/run/docker.sock:/var/run/docker.sock -v /etc/localtime:/etc/localtime:ro -v /etc/timezone:/etc/timezone:ro --name astrbot soulter/astrbot:latest 86 | > ``` 87 | 88 | ## 🎉 大功告成 89 | 90 | 如果一切顺利,你会看到 AstrBot 打印出的日志。 91 | 92 | 如果没有报错,你会看到一条日志显示类似 `🌈 管理面板已启动,可访问` 并附带了几条链接。打开其中一个链接即可访问 AstrBot 管理面板。 93 | 94 | > [!TIP] 95 | > 由于 Docker 隔离了网络环境,所以不能使用 `localhost` 访问管理面板。 96 | > 97 | > 默认用户名和密码是 `astrbot` 和 `astrbot`。 98 | > 99 | > 如果部署在云服务器上,需要在相应厂商控制台里放行 `6180-6200` 和 `11451` 端口。 100 | 101 | 接下来,你需要部署任何一个消息平台,才能够实现在消息平台上使用 AstrBot。 102 | -------------------------------------------------------------------------------- /deploy/astrbot/image-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/deploy/astrbot/image-1.png -------------------------------------------------------------------------------- /deploy/astrbot/image-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/deploy/astrbot/image-2.png -------------------------------------------------------------------------------- /deploy/astrbot/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/deploy/astrbot/image.png -------------------------------------------------------------------------------- /deploy/astrbot/linux-one.md: -------------------------------------------------------------------------------- 1 | # 通过 Linux 一键脚本安装 2 | 3 | > [!WARNING] 4 | > 1. 该脚本由社区 **@小馒头** 提供(感谢❤)。 5 | > 2. AstrBot 团队不保证该脚本的可用性,并且不参与该脚本的维护工作。我们推荐 Linux 用户手动部署或者通过 Docker 部署 AstrBot。 6 | 7 | ![](../../source/images/linux-one/5bae97bb68f367923f63dd3f1607a7df.png) 8 | 9 | ## 使用 10 | 11 | 在终端执行 12 | 13 | CentOS安装脚本: 14 | 15 | ```bash 16 | bash <(curl -sSL https://gitee.com/mc_cloud/mccloud_bot/raw/master/mccloud_install.sh) 17 | ``` 18 | 19 | Ubuntu安装脚本: 20 | 21 | ```bash 22 | wget -O - https://gitee.com/mc_cloud/mccloud_bot/raw/master/mccloud_install_u.sh | bash 23 | ``` 24 | 25 | 支持 QQ 微信 一键管理。命令:bot 26 | 27 | 28 | ## 备注 29 | 30 | @小馒头: 免费试用:https://idc.stay33.cn/free.html 31 | 云电脑挂机宝新人只需要0元/月 后面续费只需要3.33元 4核4G 32 | 购买优惠码:MCCloud_BOT -------------------------------------------------------------------------------- /deploy/astrbot/rainyun.md: -------------------------------------------------------------------------------- 1 | # 通过 雨云 一键部署 2 | 3 | [雨云](https://www.rainyun.com/about)成立于 2018 年,是具有自主知识产权的国产云计算服务提供商,具有可靠的营业资质和实体办公场所。 4 | 5 | AstrBot 已经上架至雨云的预装软件列表,支持**一键安装** AstrBot 并提供高性能的云计算资源,保证 `AstrBot` 24 小时在线。 6 | 7 | ## 部署服务器 8 | 9 | 在这一步,你需要选购一个云服务器,最低价格为 `9` 元/月,当然,你也可以选购更高配置的服务器。 10 | 11 | > [!NOTE] 12 | > 由于 `gewechat` 运行时占用资源较多,如果您希望在服务器上同时部署 `gewechat`,所选的服务器配置内存需要 >= `4096 MB`,否则可能会出现内存不足的情况。 13 | 14 | 1. 打开 [雨云官网](https://www.rainyun.com/NjU1ODg0_)。 15 | 2. 根据你的喜好和预算,选择一个合适的服务器配置。 16 | - 😉 如果您的预算不是很充足,可以选择:`江苏宿迁` - `Xeon® Gold (金牌)` - `KVM 入门版`/`KVM 标配版`/`KVM 中配版`/`KVM 高配版` 配置组合。这个配置组合的价格分别为 `9` 元/月, `12.5` 元/月, `17.5` 元/月和 `24` 元/月,适合个人用户使用。但是 `江苏宿迁` 的节点**没有公网 IP**,需要经过端口映射。如果您购买了这个地区的服务器,可以参见下文 [附录: 配置端口映射](#附录-配置端口映射) 来配置。如果您需要公网 IP,请购买其他地区的服务器。 17 | - 🥰 如果您希望更支持和长期使用本开源项目,可以选购更高配置和更长时长的服务器。(所有的推广费用将 **只用于** AstrBot 目前使用的雨云服务器的开销,约 `1400` 元 / 年) 18 | 3. 在下面的 `系统和软件安装` 一节,选中 `AstrBot`,然后点击 `立即购买`。 19 | 4. 如果您的余额不足,将会跳转至充值页面。充值完成后再返回点击 `立即购买` 即可。 20 | 21 | ![AstrBot - 系统和软件安装](image.png) 22 | 23 | 接下来,雨云会自动帮您安装好系统和 `AstrBot` 软件。 24 | 25 | 如果有疑问,请: 26 | 27 | 1. 点击雨云官网右下角 `咨询` 提交工单 28 | 2. 点击雨云官网上方 `交流社区` 添加雨云 QQ 群。 29 | 30 | ## 附录: 配置端口映射 31 | 32 | > [!NOTE] 33 | > 只有当您购买的是 `江苏宿迁` 的服务器时,才需要配置端口映射。 34 | 35 | 通过 `我的云服务器` 进入 `云服务器` 页面,可以看到 `NAT端口映射管理` 卡片,如下图所示: 36 | 37 | ![NAT端口映射管理](image-1.png) 38 | 39 | 点击 `+端口设置` -> `新建规则`,如下图所示: 40 | 41 | ![创建NAT端口映射规则](image-2.png) 42 | 43 | 然后,内网端口填写 `6185`,点击 `创建映射规则`,这样就可以通过 `http://IP:上面设置好的外网端口` 访问 AstrBot 的管理面板了。 44 | -------------------------------------------------------------------------------- /deploy/astrbot/windows.md: -------------------------------------------------------------------------------- 1 | # 使用 Windows 一键安装器部署 AstrBot 2 | 3 | 安装器是一个使用 `Powershell` 编写的脚本,体积小巧,<20KB。需要您的电脑上安装有 `Powershell`,一般 `Windows 10` 及以上版本的设备都会自带这个工具。 4 | 5 | > [!WARNING] 6 | > 需要您的电脑上安装有 `Python 3.10` 及以上的版本,并且已经配置好环境变量。 7 | 8 | > [!TIP] 9 | > 如果部署不了,请参阅其他两个部署方式:Docker 部署和 手动部署。 10 | 11 | 12 | ## 下载安装器 13 | 14 | 打开 https://github.com/AstrBotDevs/AstrBotLauncher/releases/latest 15 | 16 | 下载 `Source code (zip)` 并解压到您的电脑。 17 | 18 | ## 运行安装器 19 | 20 | > 视频和此处不一致,请参考此处!!!如果部署不了,请参阅其他两个部署方式:Docker 部署和 手动部署。 21 | 22 | 解压后,打开文件夹, 23 | 24 | 地址栏输入 Powershell 并打开: 25 | 26 | ![](../../source/images/windows/image-4.png) 27 | 28 | 将 `launcher_astrbot_en.bat` 批处理文件拖进去回车运行。 29 | 30 | > [!WARNING] 31 | > - 这个脚本没有病毒。如果提示 `Windows 已保护您的电脑`,请点击 `更多信息`,然后点击 `仍要运行`。 32 | > 33 | > - 脚本默认使用 `python` 指令来执行代码,如果你想指定 Python 解释器器路径或者指令,请修改 `launcher_astrbot_en.bat` 文件。找到 `set PYTHON_CMD=python` 这一行,将 `python` 改为你的 Python 解释器路径或指令。 34 | > 35 | 36 | 如果没有检测到 Python 环境,脚本将会提示并退出。 37 | 38 | 脚本将自动检测目录下是否有 `AstrBot` 文件夹,如果没有,将会从 [GitHub](https://github.com/AstrBotDevs/AstrBot/releases/latest) 自动下载最新的 AstrBot 源码。下载好后,会自动安装 AstrBot 的依赖并运行。 39 | 40 | ## 🎉 大功告成! 41 | 42 | 如果一切顺利,你会看到 AstrBot 打印出的日志。 43 | 44 | 如果没有报错,你会看到一条日志显示类似 `🌈 管理面板已启动,可访问` 并附带了几条链接。打开其中一个链接即可访问 AstrBot 管理面板。 45 | 46 | > [!TIP] 47 | > 默认用户名和密码是 `astrbot` 和 `astrbot`。 48 | > 49 | > **当管理面板打开时遇到 404 错误:** 50 | > 在 [release](https://github.com/AstrBotDevs/AstrBot/releases) 页面下载dist.zip,解压拖到 AstrBot/data 下。还不行请重启电脑(来自群里的反馈) 51 | 52 | 接下来,你需要部署任何一个消息平台,才能够实现在消息平台上使用 AstrBot。 53 | 54 | 55 | > [!TIP] 56 | > 如果部署不了,请参阅其他两个部署方式:Docker 部署和 手动部署。 57 | 58 | 59 | ## 报错:Python is not installed 60 | 61 | 如果提示 Python is not installed,并且已经安装 Python,并且**也已经重启并仍报这个错误**,说明环境变量不对,有两个方法解决: 62 | 63 | **方法 1:** 64 | 65 | windows 搜索 Python,打开文件位置: 66 | 67 | ![](../../source/images/windows/image.png) 68 | 69 | 右键下面这个快捷方式,打开文件所在位置: 70 | 71 | ![alt text](../../source/images/windows/image-1.png) 72 | 73 | 复制文件地址: 74 | 75 | ![](../../source/images/windows/image-2.png) 76 | 77 | 回到 `launcher_astrbot_en.bat` 文件,右键点击 `在记事本中编辑`,找到 `set PYTHON_CMD=python` 这一行,将 `python` 改为你的 Python 解释器路径或指令,路径两端的双引号不要删。 78 | 79 | **方法 2:** 80 | 81 | 重装 python,并且在安装时勾选 `Add Python to PATH`,然后重启电脑。 -------------------------------------------------------------------------------- /deploy/platform/8287fd9fec5823847e6b590dc3f0f545.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/deploy/platform/8287fd9fec5823847e6b590dc3f0f545.png -------------------------------------------------------------------------------- /deploy/platform/aiocqhttp/lagrange.md: -------------------------------------------------------------------------------- 1 | # 接入 Lagrange 2 | 3 | > [!TIP] 4 | > - 请合理控制使用频率。过于频繁地发送消息可能会被判定为异常行为,增加触发风控机制的风险。 5 | > - 本项目严禁用于任何违反法律法规的用途。若您意图将 AstrBot 应用于非法产业或活动,我们**明确反对并拒绝**您使用本项目。 6 | 7 | 8 | > [!TIP] 9 | > 最新的部署方式请以 [Lagrange Doc](https://lagrangedev.github.io/Lagrange.Doc/Lagrange.OneBot/Config/#%E4%B8%8B%E8%BD%BD%E5%AE%89%E8%A3%85) 为准。 10 | 11 | ## 下载 12 | 13 | 从 [GitHub Release](https://github.com/LagrangeDev/Lagrange.Core/releases) 下载最新版的 `Lagrange.OneBot`。 14 | 15 | 对于 Windows 设备,请下载 `Lagrange.OneBot_win-x64_xxxx` 压缩包。 16 | 17 | 对于 X86 的 Linux 用户,下载 `Lagrange.OneBot_linux-x64_xxx` 压缩包。 18 | 19 | 对于 Arm 的 Linux 用户,下载 `Lagrange.OneBot_linux-arm64_xxx` 压缩包。 20 | 21 | 对于 M 芯片 Mac 用户,下载 `Lagrange.OneBot_osx-arm64_xxx` 压缩包。 22 | 23 | 对于 Intel 芯片 Mac 用户,下载 `Lagrange.OneBot_osx-x64_xxx` 压缩包。 24 | 25 | ## 部署 26 | 27 | 请参阅 [Lagrange Doc](https://lagrangedev.github.io/Lagrange.Doc/Lagrange.OneBot/Config/#%E8%BF%90%E8%A1%8C)。 28 | 29 | 运行完成后,请修改 [配置文件](https://lagrangedev.github.io/Lagrange.Doc/Lagrange.OneBot/Config/#%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6), 30 | 31 | 在 `Implementations` 字段下添加: 32 | 33 | ```json 34 | { 35 | "Type": "ReverseWebSocket", 36 | "Host": "127.0.0.1", 37 | "Port": 6199, 38 | "Suffix": "/ws", 39 | "ReconnectInterval": 5000, 40 | "HeartBeatInterval": 5000, 41 | "AccessToken": "" 42 | } 43 | ``` 44 | 45 | 一定要保证 `Suffix` 为 `/ws`。 46 | 47 | 48 | ## 连接到 AstrBot 49 | 50 | ### 配置 aiocqhttp 51 | 52 | 1. 进入 AstrBot 的管理面板 53 | 2. 点击左边栏 `消息平台` 54 | 3. 然后在右边的界面中,点击 `+ 新增适配器` 55 | 4. 选择 `aiocqhttp(OneBotv11)` 56 | 57 | 弹出的配置项填写: 58 | 59 | 配置项填写: 60 | 61 | - ID(id):随意填写,用于区分不同的消息平台实例。 62 | - 启用(enable): 勾选。 63 | - 反向 WebSocket 主机地址:请填写你的机器的 IP 地址。一般情况下请直接填写 `0.0.0.0` 64 | - 反向 WebSocket 端口:填写一个端口,例如 `6199`。 65 | -------------------------------------------------------------------------------- /deploy/platform/aiocqhttp/napcat.md: -------------------------------------------------------------------------------- 1 | # 通过 NapCatQQ 协议实现端接入 QQ 2 | 3 | > [!TIP] 4 | > - 请合理控制使用频率。过于频繁地发送消息可能会被判定为异常行为,增加触发风控机制的风险。 5 | > - 本项目严禁用于任何违反法律法规的用途。若您意图将 AstrBot 应用于非法产业或活动,我们**明确反对并拒绝**您使用本项目。 6 | 7 | NapCatQQ 是基于无头 QQNT 的 OneBot 协议实现端。它本质上运行了一个 QQNT 实例。 8 | 9 | NapCatQQ 的 GitHub 仓库:[NapCatQQ](https://github.com/NapNeko/NapCatQQ) 10 | NapCatQQ 的文档:[NapCatQQ 文档](https://napcat.napneko.icu/) 11 | 12 | > [!WARNING] 13 | > 前置准备: 14 | > - 一个 QQ 号(最好不是新创建的 QQ 号)。 15 | > - 一台具有摄像功能的手机以扫码登录 QQ。 16 | 17 | NapCat 提供了大量的部署方式,包括 Docker、Windows 一键安装包等等。 18 | 19 | ## 通过一键脚本部署 20 | 21 | 推荐采用这种方式部署。 22 | 23 | ### Windows 24 | 25 | 看这篇文章:[NapCat.Shell - Win手动启动教程](https://napneko.github.io/guide/boot/Shell#napcat-shell-win%E6%89%8B%E5%8A%A8%E5%90%AF%E5%8A%A8%E6%95%99%E7%A8%8B) 26 | 27 | ### Linux 28 | 29 | 看这篇文章:[NapCat.Installer - Linux一键使用脚本(支持Ubuntu 20+/Debian 10+/Centos9)](https://napneko.github.io/guide/boot/Shell#napcat-installer-linux%E4%B8%80%E9%94%AE%E4%BD%BF%E7%94%A8%E8%84%9A%E6%9C%AC-%E6%94%AF%E6%8C%81ubuntu-20-debian-10-centos9) 30 | 31 | 32 | > [!TIP] 33 | > **Napcat WebUI 在哪打开**: 34 | > 在 napcat 的日志里会显示 WebUI 链接。 35 | > 36 | > 如果是 linux 命令行一键部署的napcat:`docker log `。 37 | > 38 | > Docker部署的 NapCat:`docker logs napcat`。 39 | 40 | ## 通过 Docker Compose 部署 41 | 42 | > [!TIP] 43 | > 如果用 Docker Compose 部署,NapCat 侧无需配置,通过 NapCat WebUI (工作在端口 6099) 或 `docker logs napcat` 登录,仅在 AstrBot 侧开启 aiocqhttp 适配器即可连接,并且可以直接实现文件 `语音数据`、`文件数据` 正常接收与发送。 44 | 45 | 1. 下载或复制 [astrbot.yml](https://github.com/NapNeko/NapCat-Docker/blob/main/compose/astrbot.yml) 内容 46 | 2. 将刚刚下载的文件重命名为 `astrbot.yml` 47 | 3. 在 `astrbot.yml` 文件所在目录执行: 48 | 49 | ```bash 50 | NAPCAT_UID=$(id -u) NAPCAT_GID=$(id -g) docker-compose -f ./astrbot.yml up -d 51 | ``` 52 | 53 | ## 通过 Docker 部署 54 | 55 | > [!TIP] 56 | > 如果用 Docker 部署,将无法正常接收到`语音数据`、`文件数据`。这意味着语音转文字、沙箱的文件输入功能将无法使用。可以接收到文字消息、图片消息等其他类型的消息。 57 | 58 | 默认您安装了 Docker。 59 | 60 | 在终端执行以下命令即可一键部署。 61 | 62 | ```bash 63 | docker run -d \ 64 | -e NAPCAT_GID=$(id -g) \ 65 | -e NAPCAT_UID=$(id -u) \ 66 | -p 3000:3000 \ 67 | -p 3001:3001 \ 68 | -p 6099:6099 \ 69 | --name napcat \ 70 | --restart=always \ 71 | mlikiowa/napcat-docker:latest 72 | ``` 73 | 74 | 执行成功后,需要查看日志以得到登录二维码和管理面板的 URL。 75 | 76 | ```bash 77 | docker logs napcat 78 | ``` 79 | 80 | 请复制管理面板的 URL,然后在浏览器中打开备用。 81 | 82 | 然后使用你要登录的 QQ 扫描出现的二维码,即可登录。 83 | 84 | 如果登录阶段没有出现问题,即成功部署。 85 | 86 | ## 连接到 AstrBot 87 | 88 | ## 在 AstrBot 配置 aiocqhttp 89 | 90 | 1. 进入 AstrBot 的管理面板 91 | 2. 点击左边栏 `消息平台` 92 | 3. 然后在右边的界面中,点击 `+ 新增适配器` 93 | 4. 选择 `aiocqhttp(OneBotv11)` 94 | 95 | 弹出的配置项填写: 96 | 97 | 配置项填写: 98 | 99 | - ID(id):随意填写,用于区分不同的消息平台实例。 100 | - 启用(enable): 勾选。 101 | - 反向 WebSocket 主机地址:请填写你的机器的 IP 地址。一般情况下请直接填写 `0.0.0.0` 102 | - 反向 WebSocket 端口:填写一个端口,例如 `6199`。 103 | 104 | 点击 `保存`。 105 | 106 | ### 配置管理员 107 | 108 | 填写完毕后,进入 `配置` 页,点击 `其他配置` 选项卡,找到 `管理员 ID`,填写你的 QQ 号(不是机器人的 QQ 号)。 109 | 110 | 切记点击右下角 `保存`,AstrBot 重启并会应用配置。 111 | 112 | ### 在 NapCatQQ 中添加 WebSocket 客户端 113 | 114 | 切换回 NapCatQQ 的管理面板,点击 `网络配置->新建->WebSockets客户端`。 115 | 116 | ![](https://napneko.github.io/assets/use/Astrbot-onebot-2.png) 117 | 118 | 在新弹出的窗口中: 119 | 120 | - 勾选 `启用`。 121 | - `URL` 填写 `ws://宿主机IP:端口/ws`。如 `ws://1.2.3.4:6199/ws`。 122 | - 消息格式:`Array` 123 | - 心跳间隔: `5000` 124 | - 重连间隔: `5000` 125 | 126 | > [!WARNING] 127 | > 1. 切记后面加一个 `/ws`! 128 | > 2. 这里的 IP 不是 `0.0.0.0` 129 | 130 | 点击 `保存`。 131 | 132 | 前往 AstrBot WebUI `控制台`,如果出现 `aiocqhttp(OneBot v11) 适配器已连接。` 相关蓝色的日志,说明连接成功。 133 | 134 | ## 🎉 大功告成! 135 | 136 | 此时,你的 AstrBot 和 NapCatQQ 应该已经连接成功。使用 `私聊` 的方式在 QQ 对机器人发送 `/help` 以检查是否连接成功。 137 | -------------------------------------------------------------------------------- /deploy/platform/aiocqhttp/others.md: -------------------------------------------------------------------------------- 1 | 支持接入所有适配了 OneBotv11 反向 Websockets(AstrBot 做服务器端) 的机器人协议端。 -------------------------------------------------------------------------------- /deploy/platform/dingtalk.md: -------------------------------------------------------------------------------- 1 | # 接入钉钉 DingTalk 2 | 3 | ## 创建和配置应用 4 | 5 | 前往 [钉钉开放平台](https://open-dev.dingtalk.com/fe/app),点击创建应用: 6 | 7 | ![](../../source/images/dingtalk/image-4.png) 8 | 9 | 创建好之后,添加应用能力,选择机器人: 10 | 11 | ![](../../source/images/dingtalk/image-5.png) 12 | 13 | 点击机器人配置,填写填写机器人相关信息: 14 | 15 | ![](../../source/images/dingtalk/image-7.png) 16 | 17 | 确认无误后,点击下面的发布按钮。 18 | 19 | 点击凭证与基础信息,将 `ClientID` 和 `ClientSecret` 复制下来。 20 | 21 | ## 开始连接 22 | 23 | 打开 AstrBot 管理面板-> `+ 新增适配器`,创建一个钉钉适配器。 24 | 25 | 将刚刚复制的 `ClientID` 和 `ClientSecret` 填入,点击保存,AstrBot 将会自动向钉钉开放平台请求。 26 | 27 | 回到钉钉开放平台,点击事件订阅,选择 `Stream 模式推送`,点击保存,如果没有意外情况,将会看到 连接接入成功 字样。 28 | 29 | ![](../../source/images/dingtalk/image-8.png) 30 | 31 | 点击保存即可。 32 | 33 | ## 发布版本 34 | 35 | 点击边栏的 版本管理与发布,创建一个新版本。 36 | 37 | 填写应用版本号、版本描述、应用可见范围(选择全部员工或者按照您的需求),点击保存,确认发布。 38 | 39 | ![alt text](../../source/images/dingtalk/image-11.png) 40 | 41 | 找到一个钉钉群聊,点击右上角的设置: 42 | 43 | ![](../../source/images/dingtalk/image-12.png) 44 | 45 | 下拉找到添加机器人,然后找到刚刚创建的机器人,点击添加即可: 46 | 47 | ![](../../source/images/dingtalk/image-9.png) 48 | 49 | ## 🎉 大功告成! 50 | 51 | 在群聊中 @ 机器人后附带 `/help` 指令,如果机器人回复了,那么说明接入成功。 -------------------------------------------------------------------------------- /deploy/platform/gewechat.md: -------------------------------------------------------------------------------- 1 | 本页面已经迁移至 [Gewechat](/deploy/platform/wechat/gewechat)。 -------------------------------------------------------------------------------- /deploy/platform/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/deploy/platform/image.png -------------------------------------------------------------------------------- /deploy/platform/lark.md: -------------------------------------------------------------------------------- 1 | # 接入飞书 2 | 3 | ## 常见问题 4 | 5 | 如果发现 `加载平台适配器 lark 失败,原因:No module named 'lark_oapi'。请检查依赖库是否安装。提示:可以在 管理面板->控制台->安装Pip库 中安装依赖库。` 报错,说明没有安装 `lark_oapi` 库,请根据提示安装或者直接通过 pip 安装。 6 | 7 | ## 创建机器人 8 | 9 | 前往 [开发者后台](https://open.feishu.cn/app) ,创建企业自建应用。 10 | 11 | ![](../../source/images/lark/image.png) 12 | 13 | 添加应用能力——机器人。 14 | 15 | ![](../../source/images/lark/image-1.png) 16 | 17 | 点击凭证与基础信息,获取 app_id 和 app_secret。 18 | 19 | ![](../../source/images/lark/image-4.png) 20 | 21 | ## 配置 AstrBot 22 | 23 | 1. 进入 AstrBot 的管理面板 24 | 2. 点击左边栏 `消息平台` 25 | 3. 然后在右边的界面中,点击 `+ 新增适配器` 26 | 4. 选择 `lark(飞书)` 27 | 28 | 弹出的配置项填写: 29 | 30 | - ID(id):随意填写,用于区分不同的消息平台实例。 31 | - 启用(enable): 勾选。 32 | - app_id: 获取的 app_id 33 | - app_secret: QQ 官方机器人中获取的 app_secret 34 | - 飞书机器人的名字 35 | 36 | 如果您正在用国际版飞书,请将 `domain` 设置为 `https://open.larksuite.com`。 37 | 38 | 点击 `保存`。 39 | 40 | ## 设置回调和权限 41 | 42 | 接下来,点击事件与回调,使用长连接接收事件,点击保存。**如果上一步没有成功启动,那么这里将无法保存。** 43 | 44 | ![](../../source/images/lark/image-6.png) 45 | 46 | 点击添加事件,消息与群组,下拉找到 `接收消息`,添加。 47 | 48 | ![](../../source/images/lark/image-7.png) 49 | 50 | 点击开通以下权限。 51 | 52 | ![](../../source/images/lark/image-8.png) 53 | 54 | 再点击上面的`保存`按钮。 55 | 56 | 接下来,点击权限管理,点击开通权限,输入 `im:message:send,im:message,im:message:send_as_bot`。添加筛选到的权限。 57 | 58 | 再次输入 `im:resource:upload,im:resource` 开通上传图片相关的权限。 59 | 60 | 最终开通的权限如下图: 61 | 62 | ![alt text](../../source/images/lark/image-11.png) 63 | 64 | ## 创建版本 65 | 66 | 创建版本。 67 | 68 | ![](../../source/images/lark/image-2.png) 69 | 70 | 填写版本号,更新说明,可见范围后点击保存,确认发布。 71 | 72 | ## 拉入机器人到群组 73 | 74 | 进入飞书 APP(网页版飞书无法添加机器人),点进群聊,点击右上角按钮->群机器人->添加机器人。 75 | 76 | 搜索刚刚创建的机器人的名字。比如教程创建了 `AstrBot` 机器人: 77 | 78 | ![](../../source/images/lark/image-9.png) 79 | 80 | ## 🎉 大功告成 81 | 82 | 在群内发送一个 `/help` 指令,机器人将做出响应。 83 | 84 | ![](../../source/images/lark/image-13.png) -------------------------------------------------------------------------------- /deploy/platform/qqofficial/webhook.md: -------------------------------------------------------------------------------- 1 | 2 | # 通过 QQ官方机器人 接入 QQ (Webhook) 3 | 4 | ## 申请一个机器人 5 | 6 | > [!WARNING] 7 | > 1. 截至目前,QQ 官方机器人需要设置 IP 白名单。 8 | > 2. 支持群聊、私聊、频道聊天、频道私聊。 9 | > 10 | > 需要一台带有公网 IP 的服务器和域名(如果没备案,需要服务器在海外或者中国港澳台) 11 | 12 | 首先,打开 [QQ官方机器人](https://q.qq.com) 并登录。 13 | 14 | 然后,点击创建机器人,填写名称、简介、头像等信息。然后点击下一步、提交审核。等待安全校验通过后,创建成功。 15 | 16 | 点击创建好的机器人,然后你将会被导航到机器人的管理页面。如下图所示: 17 | 18 | ![](../../../source/images/qqofficial/image.png) 19 | 20 | ## 允许机器人加入频道/群/私聊 21 | 22 | 点击`沙箱配置`,这允许你立即设置一个沙箱频道/QQ群/QQ私聊,用于拉入机器人(需要小于等于20个人)。 23 | 24 | 然后你将会看到 QQ 群配置、消息列表配置和 QQ 频道配置。根据你的需求来选择QQ群、允许私聊的QQ号、QQ频道。 25 | 26 | ![](../../../source/images/qqofficial/image-1.png) 27 | 28 | ## 获取 appid、secret 29 | 30 | 添加机器人到你想用的地方后。 31 | 32 | 点击 `开发->开发设置`,找到 appid、secret。复制并保存它们。 33 | 34 | ## 添加 IP 白名单 35 | 36 | 点击 `开发->开发设置`,找到 IP 白名单。添加你的服务器 IP 地址。 37 | 38 | ![](../../../source/images/qqofficial/image-3.png) 39 | 40 | ## 在 AstrBot 配置 41 | 42 | 1. 进入 AstrBot 的管理面板 43 | 2. 点击左边栏 `消息平台` 44 | 3. 然后在右边的界面中,点击 `+ 新增适配器` 45 | 4. 选择 `qq_official_webhook` 46 | 47 | 弹出的配置项填写: 48 | 49 | - ID(id):随意填写,用于区分不同的消息平台实例。 50 | - 启用(enable): 勾选。 51 | - appid: QQ 官方机器人中获取的 appid。 52 | - secret: QQ 官方机器人中获取的 secret。 53 | 54 | 点击 `保存`。 55 | 56 | ## 设置回调地址 57 | 58 | 在 `开发->回调配置` 处,配置回调地址。这需要你拥有一个公网 IP 服务器和域名。 59 | 60 | 请求地址填写 `<你的域名>/astrbot-qo-webhook/callback` 61 | 62 | 你的域名应当通过 `Caddy`, `Nginx`, `Apache` 等 Web 服务器反向代理来自 AstrBot 暴露的 `6196` 端口的流量。 63 | 64 | 填写好之后,添加事件,四个事件类型都全选:单聊事件、群事件、频道事件等,如下图。 65 | 66 | ![](../../../source/images/webhook/image.png) 67 | 68 | 输入完成后,将光标挪出输入框,将会发送一次验证请求。如果没问题,右边的确定配置按钮将可点击,点击即可。 69 | 70 | 接着重启 AstrBot。 71 | 72 | ## 🎉 大功告成! 73 | 74 | 此时,你的 AstrBot 应该已经连接成功。如果发送消息没有反应,请等待一两分钟后重启 AstrBot 再进行确认(测试时发现回调地址不会立即生效)。 75 | 76 | ## 附录:如何配置反向代理 77 | 78 | 如果你还没有相关经验,这里推荐使用 Caddy 作为反向代理的工具,请参考: 79 | 80 | 1. 安装 Caddy: https://caddy2.dengxiaolong.com/docs/install 81 | 2. 设置反向代理: https://caddy2.dengxiaolong.com/docs/quick-starts/reverse-proxy 82 | 83 | Caddy 将自动为您申请 TLS 证书,以达到接入 Webhook 的目的。 -------------------------------------------------------------------------------- /deploy/platform/qqofficial/websockets.md: -------------------------------------------------------------------------------- 1 | 2 | # 通过 QQ官方机器人 接入 QQ (Websockets) 3 | 4 | ## 申请一个机器人 5 | 6 | > [!WARNING] 7 | > 1. 截至目前,QQ 官方机器人需要设置 IP 白名单。 8 | > 2. 支持群聊、私聊、频道聊天、频道私聊。 9 | > 10 | > 由于腾讯即将终止对 Websockets 接入的支持,目前不再推荐使用此方式部署机器人,请使用 [Webhook](/deploy/platform/qqofficial/webhook) 方式。 11 | 12 | 13 | 首先,打开 [QQ官方机器人](https://q.qq.com) 并登录。 14 | 15 | 然后,点击创建机器人,填写名称、简介、头像等信息。然后点击下一步、提交审核。等待安全校验通过后,创建成功。 16 | 17 | 点击创建好的机器人,然后你将会被导航到机器人的管理页面。如下图所示: 18 | 19 | ![](../../../source/images/qqofficial/image.png) 20 | 21 | ## 允许机器人加入频道/群/私聊 22 | 23 | 点击`沙箱配置`,这允许你立即设置一个沙箱频道/QQ群/QQ私聊,用于拉入机器人(需要小于等于20个人)。 24 | 25 | 然后你将会看到 QQ 群配置、消息列表配置和 QQ 频道配置。根据你的需求来选择QQ群、允许私聊的QQ号、QQ频道。 26 | 27 | ![](../../../source/images/qqofficial/image-1.png) 28 | 29 | ## 获取 appid、secret 30 | 31 | 添加机器人到你想用的地方后。 32 | 33 | 点击 `开发->开发设置`,找到 appid、secret。复制并保存它们。 34 | 35 | ## 添加 IP 白名单 36 | 37 | 点击 `开发->开发设置`,找到 IP 白名单。添加你的服务器 IP 地址。 38 | 39 | ![](../../../source/images/qqofficial/image-3.png) 40 | 41 | > [!TIP] 42 | > 如果你不知道你的服务器 IP 地址,可以在终端中输入 `curl ifconfig.me` 来获取。或者登录 [ip138.com](https://ip138.com/) 查看。 43 | > 44 | > 如果你在没有公网 IP 的环境下,你看到的 IP 是运营商 NAT 的 IP,这个 IP 根据你的运营商的情况可能会随时变化。如有必要,可以配置代理。 45 | 46 | ## 在 AstrBot 配置 47 | 48 | 1. 进入 AstrBot 的管理面板 49 | 2. 点击左边栏 `消息平台` 50 | 3. 然后在右边的界面中,点击 `+ 新增适配器` 51 | 4. 选择 `qq_official` 52 | 53 | 弹出的配置项填写: 54 | 55 | - ID(id):随意填写,用于区分不同的消息平台实例。 56 | - 启用(enable): 勾选。 57 | - appid: QQ 官方机器人中获取的 appid。 58 | - secret: QQ 官方机器人中获取的 secret。 59 | 60 | 点击 `保存`。 61 | 62 | ## 🎉 大功告成! 63 | 64 | 此时,你的 AstrBot 和 NapCatQQ 应该已经连接成功。使用 `私聊` 的方式在 QQ 对机器人发送 `/help` 以检查是否连接成功。 -------------------------------------------------------------------------------- /deploy/platform/telegram.md: -------------------------------------------------------------------------------- 1 | 2 | # 接入 Telegram 3 | 4 | ## 1. 创建 Telegram Bot 5 | 6 | 首先,打开 Telegram,搜索 `BotFather`,点击 `Start`,然后发送 `/newbot`,按照提示输入你的机器人名字和用户名。 7 | 8 | 创建成功后,`BotFather` 会给你一个 `token`,请妥善保存。 9 | 10 | ## 2. 配置 AstrBot 11 | 12 | 1. 进入 AstrBot 的管理面板 13 | 2. 点击左边栏 `消息平台` 14 | 3. 然后在右边的界面中,点击 `+ 新增适配器` 15 | 4. 选择 `telegram` 16 | 17 | 弹出的配置项填写: 18 | 19 | - ID(id):随意填写,用于区分不同的消息平台实例。 20 | - 启用(enable): 勾选。 21 | - Bot Token: 你的 Telegram 机器人的 `token`。 22 | 23 | 请确保你的网络环境可以访问 Telegram。你可能需要使用 `配置页->其他配置->HTTP 代理` 来设置代理。 -------------------------------------------------------------------------------- /deploy/platform/wechat/gewechat.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # 通过 Gewechat 接入微信 4 | 5 | > [!WARNING] 6 | > 该方法不可用,请切换至其他方法,如 [WeChatPadPro](/deploy/platform/wechat/wechatpadpro)。 7 | 8 | 9 | ## 部署 Gewechat 10 | 11 | Gewechat 只能使用 Docker 部署,如果您没有安装 Docker,请自行安装。Windows/Mac 用户请安装 `Docker Desktop`,Linux 用户请安装 `Docker`。 12 | 13 | 最新信息请参考 [Gewechat 仓库](https://github.com/Devo919/Gewechat?tab=readme-ov-file) 部署 Gewechat。 14 | 15 | ### 拉取 Gewechat 镜像 16 | 17 | ```bash 18 | docker pull registry.cn-hangzhou.aliyuncs.com/gewe/gewe:latest 19 | docker tag registry.cn-hangzhou.aliyuncs.com/gewe/gewe gewe 20 | ``` 21 | 22 | ### 运行 Gewechat 容器 23 | 24 | ```bash 25 | mkdir gewechat 26 | docker run -itd -v ./gewechat:/root/temp -p 2531:2531 -p 2532:2532 --privileged=true --name=gewe gewe /usr/sbin/init 27 | ``` 28 | 29 | 如果需要开机自启,可以: 30 | 31 | ```bash 32 | docker update --restart=always gewe 33 | ``` 34 | 35 | 可以通过日志查看启动情况: 36 | 37 | ```bash 38 | docker logs gewe -f 39 | ``` 40 | 41 | - 启动可能会花费较长时间,大概在 10-30 秒。 42 | - 如果出现 `[!!!!!!] Failed to allocate manager object, freezing.`,请参考 [AstrBot#340](https://github.com/AstrBotDevs/AstrBot/issues/340) 43 | 44 | 启动好后,可以通过浏览器访问 `http://localhost:2531` 查看是否正常启动。 45 | 46 | ## 在 AstrBot 中配置 Gewechat 适配器 47 | 48 | 1. 进入 AstrBot 的管理面板 49 | 2. 点击左边栏 `消息平台` 50 | 3. 然后在右边的界面中,点击 `+ 新增适配器` 51 | 4. 选择 `gewechat` 52 | 53 | 弹出的配置项填写: 54 | 55 | - `ID(id)`:随意填写,用于区分不同的消息平台实例。 56 | - `启用(enable)`: 勾选。 57 | - `nickname` 请随便填一个具有辨识度的英文名,不需要是微信用户名。 58 | - `base_url` 是连接到 Gewechat 后端的 API 地址。 59 | - `host` 为回调地址主机,即 gewechat 下发事件到 AstrBot 的地址。**请填写宿主机局域网地址(windows 用 ipconfig 看,linux 用 ip -a 看) 或者服务器公网地址(如果在用服务器)** 60 | - `port` 为回调地址端口,可不修改。 61 | 62 | > [!NOTE] 63 | > 对于 Mac/Windows 使用 Docker Desktop 部署 AstrBot 部署的用户,base_url 请填写为 `http://host.docker.internal:2531`。并且回调地址端口不要修改。如果还不行,请通过 `docker inspect gewe` 查看 gewechat 容器网络的 IP 地址,然后 `http://ip地址:2531`。 64 | > 65 | > 对于 Linux 使用 Docker 部署 AstrBot 部署的用户,请通过 `docker inspect gewe` 查看 gewechat 容器网络的 IP 地址,然后 `http://ip地址:2531`。如果有公网ip,也可填写公网 ip,需要在系统和服务器云厂商安全组(如有)放行 2531 端口。 66 | > 67 | > 对于 host,如果使用 Docker Desktop 部署 AstrBot 部署的用户,请填写为 `host.docker.internal`。如果使用 Linux 使用 Docker 部署 AstrBot 部署的用户,请通过 `docker inspect astrbot` 查看 astrbot 容器网络的 IP 地址,然后填进去。 68 | > 69 | > docker inspert: 70 | > 71 | > ![](../../../source/images/gewechat/image-1.png) 72 | 73 | 点击 `保存`。 74 | 75 | - 如果出现报错 "Cannot Connect to xxxxxx:2531",请使用 `docker logs gewe` 查看 Gewechat 的日志,是否正常启动。 76 | - 如果出现报错 "创建设备失败......unexpect EOF",请关闭代理软件后重试。 77 | - 如果出现报错 "设备不存在 / 无法创建设备",请更换 AstrBot gewechat 配置里的 username 后重试。 78 | - 请确保部署 Gewechat 的机器和手机微信处于同一城市,否则可能需要验证码登录,而 Gewechat 项目目前的验证码登录功能存在异常 79 | 80 | ## 扫码登录 81 | 82 | 接下来需要查看日志。请在管理面板的 `控制台` 查看或者切终端查看。 83 | 84 | 查看 AstrBot 的终端日志输出,会出现相关引导提示。打开提示的二维码链接扫码登录即可。 85 | 86 | 87 | ## 设置白名单 88 | 89 | 由于微信的 ID 是一段非常长的随机字符串,因此没办法通过默认设置 AstrBot 管理员的方式来设置初始会话。操作步骤如下: 90 | 91 | 1. 给机器人号随便发一条消息,在终端中会出现 `会话 xxx 不在会话白名单中,已终止事件传播。` 的日志(日志等级为 `INFO`)。 92 | 2. 复制 `xxx` 的值。 93 | 3. 在管理面板 `配置->消息平台->消息平台通用配置` 中找到 `ID 白名单`,粘贴 `xxx` 的值,回车填入。 94 | 4. 点击 `保存`,等待 AstrBot 重启。 95 | 5. 尝试发送 `/help` 命令,看是否有响应。 96 | 97 | ## 注意事项 98 | 99 | 一旦登录成功,请牢记在配置时配置的 username,如果更换,则相当于使用新设备登录。频繁新设备登录容易触发风控。 100 | 101 | ## 常见问题 102 | 103 | 1. Cannot connect to host xxxx:2531。请通过 `docker logs gewe` 检查 Gewechat 容器是否正常运行。 104 | 2. host 回调地址异常。请参考 https://github.com/AstrBotDevs/AstrBot/issues/327 105 | 3. 创建设备失败。请重启 gewe 容器几次再看情况。如果还不行就等一段时间之后再尝试。 106 | 4. 设备 id 不存在。请修改 AstrBot 配置,将 gewechat 的配置中的 username 随便改一个名字后保存重启。 107 | -------------------------------------------------------------------------------- /deploy/platform/wechat/wechatpadpro.md: -------------------------------------------------------------------------------- 1 | 2 | # 通过 WeChatPadPro 接入微信 3 | 4 | **需要 AstrBot 版本 >= 3.5.10** 5 | 6 | > [!NOTE] 7 | > 8 | > 1. 这个接入方式不受微信官方支持,请注意风险。**我们建议使用受微信官方支持的方式,即使用企业微信、微信客服、微信公众号方式接入**。请控制聊天频率。如果过于频繁使用(同一时间发送消息次数过多),可能会导致更高的风控风险,请注意使用频率。 9 | 10 | ## 部署 WeChatPadPro 11 | 12 | > [!TIP] 13 | > 1. 微信限制,需要手动扫码登录 14 | > 2. 微信限制一个微信号必须**有一台手机在线**才能登录其他端。因此,你需要有一台手机登录该微信,才能使用该接入方式。请尽量保证手机和部署地设备处于同一城市。 15 | 16 | 有两种部署方式: 17 | 18 | - 不通过 Docker 部署 19 | - 通过 Docker 部署 20 | 21 | ### 不通过 Docker 部署 22 | 23 | 打开 [WeChatPadPro](https://github.com/luolin-ai/WeChatPadPro),请按照其 README 提供的部署方式部署。一般来说,最终你会部署一下三个软件: 24 | 25 | - MySQL 26 | - Redis 27 | - WeChatPadPro 28 | 29 | 并且可以通过 `http://ip:port`(ip 是 localhost 或你的公网 IP;port 是 `asset/setting.json` 中你定义的 `port` 中的端口号)打开 WeChatPadPro 的如下 API 接口页面: 30 | 31 | ![](../../../source/images/wechatpadpro/image.png) 32 | 33 | AstrBot 的成功接入依赖于您是否能够打开这个页面。 34 | 35 | ### 通过 Docker 部署 36 | 37 | 仅在 Linux 上测试了部署的成功性。 38 | 39 | > [!TIP] 40 | > 不支持 `arm64` 架构的设备。 41 | 42 | ```bash 43 | git clone https://github.com/bclz-wyz/WeChatPadPro-Docker --depth 1 44 | cd WeChatPadPro-Docker 45 | mkdir main && mkdir mysql && cd main 46 | git clone https://github.com/luolin-ai/WeChatPadPro --depth 1 47 | mv WeChatPadPro/* . # 需要将 WeChatPadPro 内所有文件放到 main 文件夹下 48 | unzip 859_service_linux.zip # 这一步会释出 stay 可执行文件 49 | cd .. # 回到 WeChatPadPro-Docker 目录 50 | mv setting.json main/assets/setting.json # 覆盖 WeChatPadPro 原来的 setting.json 文件。 51 | ``` 52 | 53 | 你可以根据你的需要,编辑 `main/assets/setting.json` 文件,也可以不编辑。建议将 `adminKey` 修改为更安全的密码。 54 | 55 | 接下来,运行容器。 56 | 57 | ```bash 58 | docker compose up -d && docker logs wechatpadpro 59 | ``` 60 | 61 | 正常情况下,会出现如下日志: 62 | 63 | ``` 64 | 版本号: v20250515.00 65 | WeChatPadPro 66 | 🚀 基于 WeChat Pad 协议的高级微信管理工具 🚀 67 | ... 68 | ... 69 | 如有任何问题或建议,欢迎通过 GitHub Issues 或邮件与我们联系。 70 | ======== ADMIN_KEY === ****** ======== 71 | connect MySQL success 72 | auto create MySQL tables success 73 | connect Redis success 74 | updateApiVersion success 75 | ``` 76 | 77 | 如果你发现出现了报错: 78 | 79 | ![failed to connect MySQL: dial tcp xxx:3306: connect: connection refused](../../../source/images/wechatpadpro/image-2.png) 80 | 81 | 这是因为 MySQL 容器还没有启动成功。 82 | 83 | 84 | 请执行 `docker ps` 查看另外两个容器 `wx_redis` 和 `wx_mysql` 是否 healthy。 85 | 86 | ![](../../../source/images/wechatpadpro/image-3.png) 87 | 88 | 在 healthy 后,重启 `wechatpadpro` 容器: 89 | 90 | ```bash 91 | docker restart wechatpadpro 92 | ``` 93 | 94 | ## 接入 AstrBot 95 | 96 | 成功部署后,进入 AstrBot WebUI: 97 | 98 | 打开消息平台 -> 新增适配器 -> wechatpadpro(微信)。 99 | 100 | ![](../../../source/images/wechatpadpro/image-4.png) 101 | 102 | - admin_key: 上面步骤中,`setting.json` 下的 `adminKey` 的值。 103 | - host 和 port:取决于你的部署情况。host 填写部署 WeChatPadPro 项目的机器的主机地址。port 填写 `setting.json` 中的 port。如果是 WeChatPadPro-Docker 部署,默认映射到了 38849 端口,如您没修改,填写这个端口即可。 104 | 105 | 填写完成后,点击保存。 106 | 107 | 进入`控制台`,查看日志,如果连接成功,会出现如下日志: 108 | 109 | ``` 110 | [12:50:16] [Core] [INFO] [wechatpadpro.wechatpadpro_adapter:69]: WeChatPadPro 设备不在线或无可用凭据,开始扫码登录流程。 111 | [12:50:16] [Core] [INFO] [wechatpadpro.wechatpadpro_adapter:189]: 成功获取授权码 112 | [12:50:16] [Core] [INFO] [wechatpadpro.wechatpadpro_adapter:81]: 请扫描以下二维码登录: https://api.pwmqr.com/qrcode/create/?url=http://weixin.qq.com/x/xxx 113 | [12:50:16] [Core] [INFO] [wechatpadpro.wechatpadpro_adapter:251]: 请在 30 秒内扫码登录!!! 114 | ``` 115 | 116 | 请打开微信扫码即可,如果超出了 30 秒,重新关开这个平台适配器即可: 117 | 118 | ![](../../../source/images/wechatpadpro/image-5.png) 119 | 120 | > [!WARNING] 121 | > **在第一次掉线之后请务必执行以下工作流程,否则将会严重提高风控风险。** 122 | > 1. 进入 WechatPadPro 的 API 接口界面,将你刚刚扫码登录的账号的 token 填入 “TOKEN_KEY”,在 ADMIN_KEY 处输入自己设置的密钥。然后点击“连接”。 123 | > 2. 然后往下翻找到“登录”——>”唤醒登录(只限扫码登陆)“,点击 ”Try it out“,再点击 ”Execute“。此时,您扫码的那台机器会弹出登录界面。这个时候就能实现老设备登录不会触发风控。 124 | > 125 | > Token Key 即授权码,获取方式如下: 126 | > 127 | > 打开 AstrBot 数据目录(AstrBot/data 目录),找到 `wechatpadpro_credentials.json` 文件,打开之后,其中的 `auth_key` 即为对应 `wxid` 的授权码。 128 | > 129 | > 如果有任何疑问,请在 [#1586](https://github.com/AstrBotDevs/AstrBot/issues/1586#issuecomment-2889426078) 下提问和得到解答。 130 | 131 | ## 常见问题 132 | 133 | ### 接收不到消息!!! 134 | 135 | 1. 检查 WeChatPadPro 是否正常启动 136 | 2. 检查 AstrBot WebUI 控制台日志,是否有与 WeChatPadPro 相关的报错 137 | 3. 如果一切无误,请尝试在平台适配器配置中启用 `是否启用主动消息轮询` -------------------------------------------------------------------------------- /deploy/platform/wecom.md: -------------------------------------------------------------------------------- 1 | # AstrBot 接入企业微信 2 | 3 | AstrBot 支持接入企业微信应用和微信客服。 4 | 5 | > [!TIP] 6 | > 如需定制开发,请联系 [community@astrbot.app](mailto:community@astrbot.app) 7 | 8 | ## 准备接入 9 | 10 | 步骤: 11 | 12 | 1. 进入 AstrBot 的管理面板 13 | 2. 点击左边栏 `消息平台` 14 | 3. 然后在右边的界面中,点击 `+ 新增适配器` 15 | 4. 选择 `wecom` 16 | 17 | 这将弹出一个对话框。接下来,不要关闭页面,转移到下一步。 18 | 19 | ## 接入方式一:微信客服 20 | 21 | > [!NOTE] 22 | > 23 | > 1. 需要 >= v3.5.7 24 | > 2. 以这种方式接入,支持在微信内使用。 25 | 26 | 1. 进入 [微信客服后台](https://kf.weixin.qq.com/),使用企业微信扫码登录。 27 | 28 | 2. **得到客服账号名。**在 `客服账号` 中创建一个客服账号,记录下名称,填入 AstrBot 配置的 `微信客服账号名` 中(不是账号 ID)。 29 | 30 | 3. **得到企业 ID。**在 [企业微信 - 企业信息](https://work.weixin.qq.com/wework_admin/frame#profile) 得到企业 ID(`Corpid`),复制到 AstrBot 配置的 `corpid` 处。 31 | 32 | 4. **回调服务器验证。**如果您之前没有使用过微信客服机器人,那么请在 `开发配置` 中点击企业内部接入右侧的 `开始使用` 按钮,您应该会看到回调配置的页面。 33 | 34 | ![](8287fd9fec5823847e6b590dc3f0f545.png) 35 | 36 | 如果您之前使用过微信客服机器人,那么在 `开发配置` 中直接找到 `回调配置`,点击修改。 37 | 38 | 回调 URL 填写: `http://你的带公网地址的服务器ip:6195/callback/command` 39 | 40 | > 请注意放行端口 41 | 42 | 点击下方的两个随机获取,得到 `Token` 和 `EncodingAESKey`,复制到 AstrBot 配置的 `token` 和 `encoding_aes_key` 处,然后点击保存配置,等待适配器加载完成。 43 | 44 | 回到微信客服 `回调配置`,点击 `完成`。如果一切无误,将会显示 `已完成`(否则会显示类似 `openapi 回调不通过` 类似的文本)。 45 | 46 | 5. **获取 Secret。** 之后,在 `开发配置` 中得到 Secret,找到复制到刚刚创建的企业微信适配器,点击编辑,然后修改配置中的 `secret`。然后再次保存配置,等待适配器加载完成。 47 | 48 | > [!TIP] 49 | > 根据 [#571](https://github.com/Soulter/AstrBot/issues/571) 的反馈,对于新注册的企业,`corp_id` 可能要注册一段时间后才生效(前后大概过了半个小时)。 50 | 51 | 然后,打开 `控制台` 页,你应该会看到如下日志: 52 | 53 | ```txt 54 | 请打开以下链接,在微信扫码以获取客服微信 ... 55 | ``` 56 | 57 | ![](../../source/images/wecom/image-13.png) 58 | 59 | 打开链接,用微信扫码,然后即可打开微信客服聊天页,输入 `help` 测试是否正常连通。 60 | 61 | ## 接入方式二:企业微信应用 62 | 63 | 进入 https://work.weixin.qq.com/wework_admin/frame#apps 64 | 65 | 点击 `我的企业`,查看并得到企业 ID(`Corpid`),复制到 AstrBot 配置的 `corpid` 处。 66 | 67 | > [!TIP] 68 | > 根据 [#571](https://github.com/Soulter/AstrBot/issues/571) 的反馈,对于新注册的企业,`corp_id` 可能要注册一段时间后才生效(前后大概过了半个小时)。 69 | 70 | ![](../../source/images/wecom/image-5.png) 71 | 72 | 点击下面的 `自建应用`,然后点击 `创建应用`,填写好应用名称、头像、应用可见范围等信息。 73 | 74 | 进入应用,查看并得到机器人的 `Secret`,复制到 AstrBot 配置的 `secret` 处。 75 | 76 | ![](../../source/images/wecom/image-4.png) 77 | 78 | 在下方,找到 `接收消息`,点击 `设置 API 接收`,进入 API 接收页面。 79 | 80 | ![](../../source/images/wecom/image-6.png) 81 | 82 | ![](../../source/images/wecom/image-9.png) 83 | 84 | 在 URL 处填入 `http://你的带公网地址的服务器ip:6195/callback/command` 85 | 86 | > 请注意放行端口 87 | 88 | 并且点击下方的两个随机获取,得到 `Token` 和 `EncodingAESKey`,复制到 AstrBot 配置的 `token` 和 `encoding_aes_key` 处。 89 | 90 | 现在应该已经填完 AstrBot 连接到企业微信的所有配置项。点击 AstrBot 配置页右下角保存,等待 AstrBot 重启。 91 | 92 | 接下来配置企业可信 IP。 93 | 94 | ![](../../source/images/wecom/image-10.png) 95 | 96 | 将你的 公网 IP 地址填写到此处,点击确定。 97 | 98 | 99 | 重启成功后,回到API 接收页面,点击下面的保存,看是否能\够保存成功。如果出现 `openapi 请求回调地址不通过` 说明配置有问题,请检查四个配置项是否填写正确。 100 | 101 | 如果能够保存成功,AstrBot 就已经能够接收信息。 102 | 103 | ## 测试 104 | 105 | 在企业微信-工作台中,找到刚刚创建的应用,发送 `/help`,看看 AstrBot 是否能够回复。 106 | 107 | ![](../../source/images/wecom/3dc9fa61145ab0dd8f56a10295affec8_720.png) 108 | 109 | ## 反向代理(自定义 API BASE) 110 | 111 | AstrBot 支持自定义企业微信的终结点以适应家庭 ip 没有固定的公网 IP 问题。 112 | 113 | 只需要将您的自定义地址填入 `api_base_url` 即可。 114 | 115 | > 如果您没有公网 ip 当然也可以购买一台服务器,推荐 阿里云 的 99 元/年的服务器。 116 | 117 | ## 语音输入 118 | 119 | 为了语音输入,需要你的电脑上安装有 `ffmpeg`。 120 | 121 | linux 用户可以使用 `apt install ffmpeg` 安装。 122 | 123 | windows 用户可以在 [ffmpeg 官网](https://ffmpeg.org/download.html) 下载安装。 124 | 125 | mac 用户可以使用 `brew install ffmpeg` 安装。 -------------------------------------------------------------------------------- /deploy/platform/weixin-official-account.md: -------------------------------------------------------------------------------- 1 | # AstrBot 接入微信公众平台 2 | 3 | AstrBot 支持接入微信公众平台(版本 >= v3.5.8),并以微信公众号的形式接入,届时,您可以直接在微信公众号聊天界面中与 AstrBot 进行交互。 4 | 5 | > [!TIP] 6 | > 如需定制开发,请联系 [community@astrbot.app](mailto:community@astrbot.app) 7 | 8 | ## 准备接入 9 | 10 | 步骤: 11 | 12 | 1. 进入 AstrBot 的管理面板 13 | 2. 点击左边栏 `消息平台` 14 | 3. 然后在右边的界面中,点击 `+ 新增适配器` 15 | 4. 选择 `weixin_official_account(微信公众平台)` 16 | 17 | 这将弹出一个对话框。接下来,不要关闭页面,转移到下一步。 18 | 19 | ## 创建/登入微信公众平台 20 | 21 | 进入[微信公众平台](https://mp.weixin.qq.com/),如果您需要接入现有的公众号请直接登录即可,如果没有,请点击立即注册然后选择 `公众号` 并填写相关信息注册。 22 | 23 | > [!NOTE] 24 | > 新注册的公众号需要花费 1-2 天审核,期间不能使用。 25 | 26 | ## 设置回调服务 27 | 28 | 点击 `设置与开发` -> `开发接口管理`。界面如下: 29 | 30 | ![开发接口管理](image.png) 31 | 32 | 记录开发者 ID(AppID) 和开发者密码(AppSecret),分别填入 AstrBot 配置的 `appid` 和 `secret` 处。 33 | 34 | 找到 IP白名单,点击查看,然后添加你的公网 IP 地址。如果有多个公网 IP 地址,换行分隔。 35 | 36 | 找到下方的服务器配置,然后点击修改配置。 37 | 38 | 39 | `URL` 请填入 `http://你的域名/callback/command` 40 | 41 | > 注意⚠️:仅支持 80 或者 443 端口。您可能需要购买域名,然后反向代理 6194 端口的流量,或者将 6194 端口改成 80 端口(注意服务器需要没有软件在占用 80 端口)。 42 | 43 | `Token` 由自己填写,请随意填写一个字符串,长度 3-32 位。并同样填入 AstrBot 配置的 `token` 处(一定要相同)。 44 | 45 | `EncodingAESKey` 请点击随机生成,然后复制到 AstrBot 配置的 `encoding_aes_key` 处。 46 | 47 | 现在应该已经填完 AstrBot 连接到企业微信的所有配置项。点击 AstrBot 配置页右下角保存,等待 AstrBot 重启。 48 | 49 | 消息加解密方式请选中 `安全模式`。 50 | 51 | 等待片刻,点击 `提交`。如果一切无误,会显示 `提交成功`。 52 | 53 | ## 测试 54 | 55 | 点击左下角你的账号头像,点击账号详情,找到 `二维码`,扫码进入到公众号聊天界面,发送 `help`,看看 AstrBot 是否能够回复。 56 | 57 | 如果可以回复,说明接入成功。 58 | 59 | > [!NOTE] 60 | > 如果没有回复,并且控制台报错 `ip xxxxx not in whitelist`,说明你没有添加公网 IP 地址到微信公众平台的 IP 白名单中。如果确认添加了,那请等待若干分钟以让微信服务器更新。 61 | 62 | ## 反向代理(自定义 API BASE) 63 | 64 | AstrBot 支持自定义企业微信的终结点以适应家庭 ip 没有固定的公网 IP 问题。 65 | 66 | 只需要将您的自定义地址填入 `api_base_url` 即可。 67 | 68 | > 如果您没有公网 ip 当然也可以购买一台服务器,推荐 阿里云 的 99 元/年的服务器。 69 | 70 | ## 语音输入 71 | 72 | 为了语音输入,需要你的电脑上安装有 `ffmpeg`。 73 | 74 | linux 用户可以使用 `apt install ffmpeg` 安装。 75 | 76 | windows 用户可以在 [ffmpeg 官网](https://ffmpeg.org/download.html) 下载安装。 77 | 78 | mac 用户可以使用 `brew install ffmpeg` 安装。 -------------------------------------------------------------------------------- /deploy/when-deployed.md: -------------------------------------------------------------------------------- 1 | # 前言 2 | 3 | 部署好后...当然是给[AstrBot](https://github.com/AstrBotDevs/AstrBot)一个 Star 啦!我在这个项目上花费了超过 800 个小时,希望你能喜欢它... 4 | 5 | AstrBot 主仓库:[![wakatime](https://wakatime.com/badge/user/915e5316-99c6-4563-a483-ef186cf000c9/project/018e705a-a1a7-409a-a849-3013485e6c8e.svg)](https://wakatime.com/badge/user/915e5316-99c6-4563-a483-ef186cf000c9/project/018e705a-a1a7-409a-a849-3013485e6c8e) 6 | 7 | AstrBot DashBoard:[![wakatime](https://wakatime.com/badge/user/915e5316-99c6-4563-a483-ef186cf000c9/project/018c440f-c177-45f8-8224-292cdf5926f3.svg)](https://wakatime.com/badge/user/915e5316-99c6-4563-a483-ef186cf000c9/project/018c440f-c177-45f8-8224-292cdf5926f3) 8 | 9 | AstrBot 文档:[![wakatime](https://wakatime.com/badge/user/915e5316-99c6-4563-a483-ef186cf000c9/project/018c9619-e195-4b94-bd7b-2ca61679145b.svg)](https://wakatime.com/badge/user/915e5316-99c6-4563-a483-ef186cf000c9/project/018c9619-e195-4b94-bd7b-2ca61679145b) 10 | 11 | ❤️ 非常欢迎您提交贡献到这个项目中,比如提交 Issue、PR。 12 | 13 | > [!TIP] 14 | > 为了该项目的可持续性,如果遇到问题,请优先提交 ISSUE,其次是在 QQ 群里提问。 15 | 16 | ## 正文 17 | 18 | 当你看到这,说明已经成功部署好消息平台并且实现了第一条指令的收发。接下来,你可以配置大语言模型,或者添加插件。请参看 `配置-接入大模型服务` 一节。 19 | 20 | -------------------------------------------------------------------------------- /dev/core/overall_architecture.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # Astrbot 整体架构 6 | 7 | ![](../../source/images/dev/overall_structure.png) 8 | 9 | # 目录大致结构 10 | 11 | - `astrbot`:核心代码 12 | - `api`: 为开发插件设计的模块和工具, 方便插件进行导入和使用 13 | - `core`: 核心代码 14 | - `dashboard`: WebUI 后端代码 15 | - `changelogs`: 更新日志 16 | - `dashboard`: WebUI 前端代码 17 | - `packages`: 保留插件 18 | - `tests`: 测试代码 19 | - `main.py`: 主程序入口 20 | -------------------------------------------------------------------------------- /dev/core/overall_operation_process.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # Astrbot 整体运行流程 6 | 7 | ## 启动 AstrBot 8 | 9 | 启动 AstrBot 后, 会从 `main.py` 开始执行, 启动阶段的主要流程如下: 10 | 11 | 1. 检查环境、检查 WebUI 文件,如缺失将自动下载; 12 | 2. 加载 WebUI 后端异步任务、加载核心(Core)相关组件 13 | 14 | ## 核心生命周期 15 | 16 | ### 启动 17 | 18 | 在核心生命周期初始化时, 会按顺序初始化以下组件: 19 | 20 | 1. 供应商管理器(ProviderManager): 用于接入不同的大模型供应商, 提供 LLM 请求接口。 21 | 2. 平台管理器(PlatformManager): 用于接入不同的平台, 提供平台请求接口。 22 | 3. 知识库管理器(KnowledgeDBManager): 用于内建知识库而不依赖外部的 LLMOps 平台。(这个功能在 v3.5.0 及之前的版本都没有被实装) 23 | 4. 会话-对话管理器(ConversationManager): 用于管理不同会话窗口和对话的映射关系。 24 | 5. 插件管理器(PluginManager): 用于接入插件。 25 | 6. 消息管道调度器(PipelineScheduler): 用于调度消息管道, 处理消息的流转。 26 | 7. 事件总线(EventBus): 用于事件的分发和处理。 27 | 28 | ### 运行 29 | 30 | AstrBot 的运行基于事件驱动, 平台适配器上报事件后,事件总线将会将事件交给流水线(PipelineScheduler)进行进一步处理。事件总线的核心结构如下: 31 | 32 | ```Python 33 | class EventBus: 34 | """事件总线: 用于处理事件的分发和处理 35 | 36 | 维护一个异步队列, 来接受各种消息事件 37 | """ 38 | 39 | def __init__(self, event_queue: Queue, pipeline_scheduler: PipelineScheduler): 40 | self.event_queue = event_queue # 事件队列 41 | self.pipeline_scheduler = pipeline_scheduler # 管道调度器 42 | 43 | async def dispatch(self): 44 | """无限循环的调度函数, 从事件队列中获取新的事件, 打印日志并创建一个新的异步任务来执行管道调度器的处理逻辑""" 45 | while True: 46 | event: AstrMessageEvent = ( 47 | await self.event_queue.get() 48 | ) # 从事件队列中获取新的事件 49 | self._print_event(event) # 打印日志 50 | asyncio.create_task( 51 | self.pipeline_scheduler.execute(event) 52 | ) # 创建新的异步任务来执行管道调度器的处理逻辑 53 | ``` 54 | 55 | 事件总线的核心是一个异步队列和一个无限循环的协程, 它不断地从这个异步队列中拿取新的事件, 并创建新的异步任务将事件交由消息管道调度器进行处理。 56 | 57 | ### 处理事件 58 | 59 | 在事件总线中存在事件时, `dispatch`协程便会将这个事件取出, 交由消息管道调度器(PipelineScheduler)进行处理。 60 | 61 | 消息管道调度器的执行设计为一种『洋葱模型』, 它的特点是: 62 | 63 | - 层层嵌套: 每个处理阶段如同洋葱的一层外皮 64 | - 双向流动: 每个请求都会"进入"每一层, 在"返回"时都会经过每一层 65 | - 前置处理与后置处理: 在洋葱模型的每一层中, 都可以在两个时间点进行处理(进入与返回时) 66 | 67 | AstrBot 消息管道调度器的『洋葱模型』的实现如下: 68 | 69 | ```Python 70 | async def _process_stages(self, event: AstrMessageEvent, from_stage=0): 71 | """依次执行各个阶段""" 72 | for i in range(from_stage, len(registered_stages)): 73 | stage = registered_stages[i] # 获取当前要执行的阶段 74 | coroutine = stage.process(event) # 调用阶段的process方法,返回协程或异步生成器 75 | 76 | if isinstance(coroutine, AsyncGenerator): 77 | # 如果返回的是异步生成器,实现洋葱模型的核心 78 | async for _ in coroutine: 79 | # 此处是前置处理完成后的暂停点(yield),下面开始执行后续阶段 80 | if event.is_stopped(): 81 | logger.debug(f"阶段 {stage.__class__.__name__} 已终止事件传播。") 82 | break 83 | 84 | # 递归调用,处理所有后续阶段 85 | await self._process_stages(event, i + 1) 86 | 87 | # 此处是后续所有阶段处理完毕后返回的点,执行后置处理 88 | if event.is_stopped(): 89 | logger.debug(f"阶段 {stage.__class__.__name__} 已终止事件传播。") 90 | break 91 | else: 92 | # 如果返回的是普通协程(不含yield的async函数),则没有洋葱模型特性 93 | # 只是简单地等待它执行完成后继续下一个阶段 94 | await coroutine 95 | 96 | if event.is_stopped(): 97 | logger.debug(f"阶段 {stage.__class__.__name__} 已终止事件传播。") 98 | break 99 | ``` 100 | 101 | 这似乎很难理解, 这里提供一个示例进行解释: 102 | 103 | 假设目前已经注册了 3 个事件处理阶段 A、B、C, 执行流程如下: 104 | 105 | ``` 106 | A开始 107 | | 108 | |--> yield (暂停A) 109 | | | 110 | | |--> B开始 111 | | | | 112 | | | |--> yield (暂停B) 113 | | | | | 114 | | | | |--> C开始 115 | | | | | | 116 | | | | | |--> C结束 117 | | | | | 118 | | | |--> B继续执行(yield后的代码) 119 | | | | | 120 | | | | |--> B结束 121 | | | 122 | |--> A继续执行(yield后的代码) 123 | | | 124 | | |--> A结束 125 | 126 | A开始 → B开始 → C开始 → C结束 → B结束 → A结束 127 | ``` 128 | -------------------------------------------------------------------------------- /dev/plugin-platform-adapter.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # 开发一个平台适配器 6 | 7 | AstrBot 支持以插件的形式接入平台适配器,你可以自行接入 AstrBot 没有的平台。如飞书、钉钉甚至是哔哩哔哩私信、Minecraft。 8 | 9 | 我们以一个平台 `FakePlatform` 为例展开讲解。 10 | 11 | 首先,在插件目录下新增 `fake_platform_adapter.py` 和 `fake_platform_event.py` 文件。前者主要是平台适配器的实现,后者是平台事件的定义。 12 | 13 | ## 平台适配器 14 | 15 | 假设 FakePlatform 的客户端 SDK 是这样: 16 | 17 | ```py 18 | import asyncio 19 | 20 | class FakeClient(): 21 | '''模拟一个消息平台,这里 5 秒钟下发一个消息''' 22 | def __init__(self, token: str, username: str): 23 | self.token = token 24 | self.username = username 25 | # ... 26 | 27 | async def start_polling(self): 28 | while True: 29 | await asyncio.sleep(5) 30 | await getattr(self, 'on_message_received')({ 31 | 'bot_id': '123', 32 | 'content': '新消息', 33 | 'username': 'zhangsan', 34 | 'userid': '123', 35 | 'message_id': 'asdhoashd', 36 | 'group_id': 'group123', 37 | }) 38 | 39 | async def send_text(self, to: str, message: str): 40 | print('发了消息:', to, message) 41 | 42 | async def send_image(self, to: str, image_path: str): 43 | print('发了消息:', to, image_path) 44 | ``` 45 | 46 | 我们创建 `fake_platform_adapter.py`: 47 | 48 | ```py 49 | import asyncio 50 | 51 | from astrbot.api.platform import Platform, AstrBotMessage, MessageMember, PlatformMetadata, MessageType 52 | from astrbot.api.event import MessageChain 53 | from astrbot.api.message_components import Plain, Image, Record # 消息链中的组件,可以根据需要导入 54 | from astrbot.core.platform.astr_message_event import MessageSesion 55 | from astrbot.api.platform import register_platform_adapter 56 | from astrbot import logger 57 | from .client import FakeClient 58 | from .fake_platform_event import FakePlatformEvent 59 | 60 | # 注册平台适配器。第一个参数为平台名,第二个为描述。第三个为默认配置。 61 | @register_platform_adapter("fake", "fake 适配器", default_config_tmpl={ 62 | "token": "your_token", 63 | "username": "bot_username" 64 | }) 65 | class FakePlatformAdapter(Platform): 66 | 67 | def __init__(self, platform_config: dict, platform_settings: dict, event_queue: asyncio.Queue) -> None: 68 | super().__init__(event_queue) 69 | self.config = platform_config # 上面的默认配置,用户填写后会传到这里 70 | self.settings = platform_settings # platform_settings 平台设置。 71 | 72 | async def send_by_session(self, session: MessageSesion, message_chain: MessageChain): 73 | # 必须实现 74 | await super().send_by_session(session, message_chain) 75 | 76 | def meta(self) -> PlatformMetadata: 77 | # 必须实现,直接像下面一样返回即可。 78 | return PlatformMetadata( 79 | "fake", 80 | "fake 适配器", 81 | ) 82 | 83 | async def run(self): 84 | # 必须实现,这里是主要逻辑。 85 | 86 | # FakeClient 是我们自己定义的,这里只是示例。这个是其回调函数 87 | async def on_received(data): 88 | logger.info(data) 89 | abm = await self.convert_message(data=data) # 转换成 AstrBotMessage 90 | await self.handle_msg(abm) 91 | 92 | # 初始化 FakeClient 93 | self.client = FakeClient(self.config['token'], self.config['username']) 94 | self.client.on_message_received = on_received 95 | await self.client.start_polling() # 持续监听消息,这是个堵塞方法。 96 | 97 | async def convert_message(self, data: dict) -> AstrBotMessage: 98 | # 将平台消息转换成 AstrBotMessage 99 | # 这里就体现了适配程度,不同平台的消息结构不一样,这里需要根据实际情况进行转换。 100 | abm = AstrBotMessage() 101 | abm.type = MessageType.GROUP_MESSAGE # 还有 friend_message,对应私聊。具体平台具体分析。重要! 102 | abm.group_id = data['group_id'] # 如果是私聊,这里可以不填 103 | abm.message_str = data['content'] # 纯文本消息。重要! 104 | abm.sender = MessageMember(user_id=data['userid'], nickname=data['username']) # 发送者。重要! 105 | abm.message = [Plain(text=data['content'])] # 消息链。如果有其他类型的消息,直接 append 即可。重要! 106 | abm.raw_message = data # 原始消息。 107 | abm.self_id = data['bot_id'] 108 | abm.session_id = data['userid'] # 会话 ID。重要! 109 | abm.message_id = data['message_id'] # 消息 ID。 110 | 111 | return abm 112 | 113 | async def handle_msg(self, message: AstrBotMessage): 114 | # 处理消息 115 | message_event = FakePlatformEvent( 116 | message_str=message.message_str, 117 | message_obj=message, 118 | platform_meta=self.meta(), 119 | session_id=message.session_id, 120 | client=self.client 121 | ) 122 | self.commit_event(message_event) # 提交事件到事件队列。不要忘记! 123 | ``` 124 | 125 | 126 | `fake_platform_event.py`: 127 | 128 | ```py 129 | from astrbot.api.event import AstrMessageEvent, MessageChain 130 | from astrbot.api.platform import AstrBotMessage, PlatformMetadata 131 | from astrbot.api.message_components import Plain, Image 132 | from .client import FakeClient 133 | from astrbot.core.utils.io import download_image_by_url 134 | 135 | class FakePlatformEvent(AstrMessageEvent): 136 | def __init__(self, message_str: str, message_obj: AstrBotMessage, platform_meta: PlatformMetadata, session_id: str, client: FakeClient): 137 | super().__init__(message_str, message_obj, platform_meta, session_id) 138 | self.client = client 139 | 140 | async def send(self, message: MessageChain): 141 | for i in message.chain: # 遍历消息链 142 | if isinstance(i, Plain): # 如果是文字类型的 143 | await self.client.send_text(to=self.get_sender_id(), message=i.text) 144 | elif isinstance(i, Image): # 如果是图片类型的 145 | img_url = i.file 146 | img_path = "" 147 | # 下面的三个条件可以直接参考一下。 148 | if img_url.startswith("file:///"): 149 | img_path = img_url[8:] 150 | elif i.file and i.file.startswith("http"): 151 | img_path = await download_image_by_url(i.file) 152 | else: 153 | img_path = img_url 154 | 155 | # 请善于 Debug! 156 | 157 | await self.client.send_image(to=self.get_sender_id(), image_path=img_path) 158 | 159 | await super().send(message) # 需要最后加上这一段,执行父类的 send 方法。 160 | ``` 161 | 162 | 最后,main.py 只需这样,在初始化的时候导入 fake_platform_adapter 模块。装饰器会自动注册。 163 | 164 | ```py 165 | from astrbot.api.star import Context, Star, register 166 | @register("helloworld", "Your Name", "一个简单的 Hello World 插件", "1.0.0") 167 | class MyPlugin(Star): 168 | def __init__(self, context: Context): 169 | from .fake_platform_adapter import FakePlatformAdapter # noqa 170 | ``` 171 | 172 | 搞好后,运行 AstrBot: 173 | 174 | ![](../source/images/plugin-platform-adapter/QQ_1738155926221.png) 175 | 176 | 这里出现了我们创建的 fake。 177 | 178 | ![](../source/images/plugin-platform-adapter/QQ_1738155982211.png) 179 | 180 | 启动后,可以看到正常工作: 181 | 182 | ![](../source/images/plugin-platform-adapter/QQ_1738156166893.png) 183 | 184 | 185 | 有任何疑问欢迎加群询问~ -------------------------------------------------------------------------------- /dev/plugin-publish.md: -------------------------------------------------------------------------------- 1 | # 插件发布 2 | 3 | 请在 https://github.com/AstrBotDevs/AstrBot_Plugins_Collection 中发布插件,合并后你的插件会在所有 AstrBot 管理面板的插件市场显示。 4 | 5 | 6 | ## 发布流程 7 | 8 | 1. https://github.com/AstrBotDevs/AstrBot_Plugins_Collection/issues/new?template=Blank+issue 创建 Issue 9 | 10 | 2. 填写内容: 11 | 12 | ![](../source/images/plugin-publish/image.png) 13 | 14 | 3. 提交 Issue 15 | 16 | 17 | 18 | 或者通过 PR 提交插件。 -------------------------------------------------------------------------------- /dev/plugin.md: -------------------------------------------------------------------------------- 1 | 本页面已经迁移至 [插件基础开发](/dev/star/plugin)。 -------------------------------------------------------------------------------- /dev/star/all_resources.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # 插件开发使用的类与数据资源索引 6 | 7 | 下面讲解一些插件开发中使用到的 AstrBot 核心提供的类与数据资源, 文档中不会介绍类的所有的属性, 部分属性和方法不建议在插件中使用, 这部分内容不会在这里介绍。 8 | 文档中默认 self 是指该类的实例, 你可以在对应类内部的任何方法中使用这些资源, 注意文档中的所有方法都省略了 self 参数, 你需要使用`self.属性名`或`self.方法名()`进行调用。 9 | 10 | ## AstrBot 消息事件 11 | 12 | - [AstrMessageEvent](/dev/star/resources/astr_message_event.md) 13 | 14 | ## 功能类 15 | 16 | - [Star](/dev/star/resources/star.md) 17 | 18 | ## 数据类 19 | 20 | - [Context](/dev/star/resources/context.md) 21 | - [StarMetadata](/dev/star/resources/star_metadata.md) 22 | -------------------------------------------------------------------------------- /dev/star/resources/astr_message_event.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | ## AstrMessageEvent 6 | 7 | AstrBot 事件, AstrBot 运行的核心, AstrBot 所有操作的运行都是事件驱动的。 8 | 在插件中, 你声明的每一个`async def`函数都是一个 Handler, 它应当是一个异步协程(无 yield 返回)或异步生成器(存在一个或多个 yield), 所有 Handler 都需要在 AstrBot 事件进入消息管道后, 被调度器触发, 在相应的阶段交由 Handler 处理。因此, 几乎所有操作都依赖于该事件, 你定义的大部分 Handler 都需要传入`event: AstrMessageEvent`参数。 9 | 10 | ```Python 11 | @filter.command("helloworld") 12 | async def helloworld(self, event: AstrMessageEvent): 13 | pass 14 | ``` 15 | 16 | 这是一个接受`helloworld`指令, 触发对应操作的示例, 它应当被定义在**插件类下**, 一般而言, 想要 AstrBot 进行消息之类操作, 都需要依赖`event`参数。 17 | 18 | ### 属性 19 | 20 | #### 消息 21 | 22 | 1. `message_str(str)`: 纯文本消息, 例如收到消息事件"你好", `event.message_str`将会是`"你好"` 23 | 2. `message_obj(AstrBotMessage)`: 消息对象, 参考: [AstrBotMessage](./astrbot_message.md) 24 | 3. `is_at_or_wake_command(bool)`: 是否@了机器人/消息带有唤醒词/为私聊(插件注册的事件监听器会让 is_wake 设为 True, 但是不会让这个属性置为 True) 25 | 26 | #### 消息来源 27 | 28 | 4. `role(str)`: 用户是否为管理员, 两个可选选项:`"member" or "admin"` 29 | 5. `platform_meta(PlatformMetadata)`: 消息平台的信息, 参考: [PlatformMetadata](./platform_metadata.md) 30 | 6. `session_id(str)`: 不包含平台的会话 id, 以 qq 平台为例, 在私聊中它是对方 qq 号, 在群聊中它是群号, 它无法标记具体平台, 建议直接使用 9 中的`unified_msg_origin`作为代替 31 | 7. `session(MessageSession)`: 会话对象, 用于唯一识别一个会话, `unified_msg_origin`是它的字符串表示, `session_id`等价于`session.session_id` 32 | 8. `unified_msg_origin(str)`: 会话 id, 格式为: `platform_name:message_type:session_id`, 建议使用 33 | 34 | #### 事件控制 35 | 36 | 9. `is_wake(bool)`: 机器人是否唤醒(通过 WakingStage, 详见: [WakingStage(施工中)]), 如果机器人未唤醒, 将不会触发后面的阶段 37 | 10. `call_llm(bool)`: 是否在此消息事件中禁止默认的 LLM 请求, 对于每个消息事件, AstrBot 会默认调用一次 LLM 进行回复 38 | 39 | ### 方法 40 | 41 | #### 消息相关 42 | 43 | 1. get_message_str 44 | 45 | ```Python 46 | get_message_str() -> str 47 | # 等同于self.message_str 48 | ``` 49 | 50 | 该方法用于获取该事件的文本消息字符串。 51 | 52 | 2. get_message_outline 53 | 54 | ```Python 55 | get_message_outline() -> str 56 | ``` 57 | 58 | 该方法用于获取消息概要, 不同于 2, 它不会忽略其他消息类型(如图片), 而是会将其他消息类型转换为对应的占位符, 例如图片会被转换为`"[图片]"` 59 | 60 | 3. get_messages 61 | 62 | ```Python 63 | get_messages() -> List[BaseMessageComponent] 64 | ``` 65 | 66 | 该方法返回一个消息列表,包含该事件中的所有消息组件。该列表中的每个组件都可以是文本、图片或其他类型的消息。组件参考: [BaseMessageComponent(施工中)] 67 | 68 | 4. get_message_type 69 | 70 | ```Python 71 | get_message_type() -> MessageType 72 | ``` 73 | 74 | 该方法用于获取消息类型, 消息类型参考: [MessageType](./message_type.md) 75 | 76 | 5. is_private_chat 77 | 78 | ```Python 79 | is_private_chat() -> bool 80 | ``` 81 | 82 | 该方法用于判断该事件是否由私聊触发 83 | 84 | 6. is_admin 85 | 86 | ```Python 87 | is_admin() 88 | # 等同于self.role == "admin" 89 | ``` 90 | 91 | 该方法用于判断该事件是否为管理员发出 92 | 93 | #### 消息平台相关 94 | 95 | 7. get_platform_name 96 | 97 | ```Python 98 | get_platform_name() -> str 99 | # 等同于self.platform_meta.name 100 | ``` 101 | 102 | 该方法用于获取该事件的平台名称, 例如`"aiocqhttp"`。 103 | 如果你的插件想只对某个平台的消息事件进行处理, 可以通过该方法获取平台名称进行判断。 104 | 105 | #### ID 相关 106 | 107 | 8. get_self_id 108 | 109 | ```Python 110 | get_self_id() -> str 111 | ``` 112 | 113 | 该方法用于获取 Bot 自身 id(自身 qq 号) 114 | 115 | 9. get_sender_id 116 | 117 | ```Python 118 | get_sender_id() -> str 119 | ``` 120 | 121 | 该方法用于获取该消息发送者 id(发送者 qq 号) 122 | 123 | 10. get_sender_name 124 | 125 | ```Python 126 | get_sender_name() -> str 127 | ``` 128 | 129 | 该方法用于获取消息发送者的昵称(可能为空) 130 | 131 | 11. get_group_id 132 | 133 | ```Python 134 | get_group_id() -> str 135 | ``` 136 | 137 | 该方法用于获取群组 id(qq 群群号), 如果不是群组消息将放回 None 138 | 139 | #### 会话控制相关 140 | 141 | 12. get_session_id 142 | 143 | ```Python 144 | get_session_id() -> str 145 | # 等同于self.session_id或self.session.session_id 146 | ``` 147 | 148 | 该方法用于获取当前会话 id, 格式为 `platform_name:message_type:session_id` 149 | 150 | 13. get_group 151 | 152 | ```Python 153 | get_group(group_id: str = None, **kwargs) -> Optional[Group] 154 | ``` 155 | 156 | 该方法用于获取一个群聊的数据, 如果不填写`group_id`, 默认返回当前群聊消息, 在私聊中如果不填写该参数将返回 None 157 | 158 | 仅适配 gewechat 与 aiocqhttp 159 | 160 | #### 事件状态 161 | 162 | 14. is_wake_up 163 | 164 | ```Python 165 | is_wake_up() -> bool 166 | # 等同于self.is_wake 167 | ``` 168 | 169 | 该方法用于判断该事件是否唤醒 Bot 170 | 171 | 15. stop_event 172 | 173 | ```Python 174 | stop_event() 175 | ``` 176 | 177 | 该方法用于终止事件传播, 调用该方法后, 该事件将停止后续处理 178 | 179 | 16. continue_event 180 | 181 | ```Python 182 | continue_event() 183 | ``` 184 | 185 | 该方法用于继续事件传播, 调用该方法后, 该事件将继续后续处理 186 | 187 | 17. is_stopped 188 | 189 | ```Python 190 | is_stopped() -> bool 191 | ``` 192 | 193 | 该方法用于判断该事件是否已经停止传播 194 | 195 | #### 事件结果 196 | 197 | 18. set_result 198 | 199 | ```Python 200 | set_result(result: Union[MessageEventResult, str]) 201 | ``` 202 | 203 | 该方法用于设置该消息事件的结果, 该结果是 Bot 发送的内容 204 | 它接受一个参数: 205 | 206 | - result: MessageEventResult(参考:[MessageEventResult(施工中)]) 或字符串, 若为字符串, Bot 会发送该字符串消息 207 | 208 | 19. get_result 209 | 210 | ```Python 211 | get_result() -> MessageEventResult 212 | ``` 213 | 214 | 该方法用于获取消息事件的结果, 该结果类型参考: [MessageEventResult(施工中)] 215 | 216 | 20. clear_result 217 | 218 | ```Python 219 | clear_result() 220 | ``` 221 | 222 | 该方法用于清除消息事件的结果 223 | 224 | #### LLM 相关 225 | 226 | 21. should_call_llm 227 | 228 | ```Python 229 | should_call_llm(call_llm: bool) 230 | ``` 231 | 232 | 该方法用于设置是否在此消息事件中禁止默认的 LLM 请求 233 | 只会阻止 AstrBot 默认的 LLM 请求(即收到消息->请求 LLM 进行回复),不会阻止插件中的 LLM 请求 234 | 235 | 22. request_llm 236 | 237 | ```Python 238 | request_llm(prompt: str, 239 | func_tool_manager=None, 240 | session_id: str = None, 241 | image_urls: List[str] = [], 242 | contexts: List = [], 243 | system_prompt: str = "", 244 | conversation: Conversation = None, 245 | ) -> ProviderRequest 246 | ``` 247 | 248 | 该方法用于创建一个 LLM 请求 249 | 250 | 接受 7 个参数: 251 | 252 | - prompt(str): 提示词 253 | - func_tool_manager(FuncCall): 函数工具管理器, 参考: [FuncCall(施工中)] 254 | - session_id(str): 已经过时, 留空即可 255 | - image_urls(List(str)): 发送给 LLM 的图片, 可以为 base64 格式/网络链接/本地图片路径 256 | - contexts(List): 当指定 contexts 时, 将使用其中的内容作为该次请求的上下文(而不是聊天记录) 257 | - system_prompt(str): 系统提示词 258 | - conversation(Conversation): 可选, 在指定的对话中进行 LLM 请求, 将使用该对话的所有设置(包括人格), 结果也会被保存到对应的对话中 259 | 260 | #### 发送消息相关 261 | 262 | 一般作为生成器返回, 让调度器执行相应操作: 263 | 264 | ```Python 265 | yield event.func() 266 | ``` 267 | 268 | 23. make_result 269 | 270 | ```Python 271 | make_result() -> MessageEventResult 272 | ``` 273 | 274 | 该方法用于创建一个空的消息事件结果 275 | 276 | 24. plain_result 277 | 278 | ```Python 279 | plain_result(text: str) -> MessageEventResult 280 | ``` 281 | 282 | 该方法用于创建一个空的消息事件结果, 包含文本消息:text 283 | 284 | 25. image_result 285 | 286 | ```Python 287 | image_result(url_or_path: str) -> MessageEventResult 288 | ``` 289 | 290 | 该方法用于创建一个空的消息事件结果, 包含一个图片消息, 其中参数`url_or_path`可以为图片网址或本地图片路径 291 | 292 | 26. chain_result 293 | 294 | ```Python 295 | chain_result(chain: List[BaseMessageComponent]) -> MessageEventResult 296 | ``` 297 | 298 | 该方法用于创建一个空的消息事件结果, 包含整个消息链, 消息链是一个列表, 按顺序包含各个消息组件, 消息组件参考: [BaseMessageComponent(施工中)] 299 | 300 | 27. send 301 | 302 | ```Python 303 | send(message: MessageChain) 304 | ``` 305 | 306 | 注意这个方法不需要使用 yield 方式作为生成器返回来调用, 请直接使用`await event.send(message)` 307 | 该方法用于发送消息到该事件的当前对话中 308 | 309 | 接受 1 个参数: 310 | 311 | - message(MessageChain): 消息链, 参考: [MessageChain(施工中)] 312 | 313 | #### 其他 314 | 315 | 28. set_extra 316 | 317 | ```Python 318 | set_extra(key, value) 319 | ``` 320 | 321 | 该方法用于设置事件的额外信息, 如果你的插件需要分几个阶段处理事件, 你可以在这里将额外需要传递的信息存储入事件 322 | 接受两个参数: 323 | 324 | - key(str): 键名 325 | - value(any): 值 326 | 327 | 需要和 12 一起使用 328 | 329 | 29. get_extra 330 | 331 | ```Python 332 | get_extra(key=None) -> any 333 | ``` 334 | 335 | 该方法用于获取 11 中设置的额外信息, 如果没有提供键名将返回所有额外信息, 它是一个字典。 336 | 337 | 30. clear_extra 338 | 339 | ```Python 340 | clear_extra() 341 | ``` 342 | 343 | 该方法用于清除该事件的所有额外信息 344 | -------------------------------------------------------------------------------- /dev/star/resources/astrbot_message.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # AstrBotMessage 6 | 7 | AstrBot 消息对象, 它是一个消息的容器, 所有平台的消息在接收时都被转换为该类型的对象, 以实现不同平台的统一处理。 8 | 9 | 对于每个事件, 一定都有一个驱动该事件的 AstrBotMessage 对象。 10 | 11 | ```mermaid 12 | 平台发来的消息 --> AstrBotMessage --> AstrBot 事件 13 | ``` 14 | 15 | ### 属性 16 | 17 | 1. `type(MessageType)`: 消息类型, 参考: [MessageType](./message_type.md) 18 | 2. `self_id(str)`: 机器人自身 id, 例如在 aiocqhttp 平台, 它是机器人自身的 qq 号 19 | 3. `session_id(str)`: 不包含平台的会话 id, 以 qq 平台为例, 在私聊中它是对方 qq 号, 在群聊中它是群号 20 | 4. `message_id(str)`: 消息 id, 消息的唯一标识符, 用于引用或获取某一条消息 21 | 5. `group_id(str)`: 群组 id, 如果为私聊, 则为空字符串 22 | 6. `sender(MessageMember)`: 消息发送者, 参考: [MessageMember](./message_member.md) 23 | 7. `message(List[BaseMessageComponent])`: 消息链(Nakuru 格式), 包含该事件中的所有消息内容, 参考: [BaseMessageComponent(施工中)] 24 | 8. `message_str(str)`: 纯文本消息字符串, 相当于把消息链转换为纯文本(会丢失信息!) 25 | 9. `raw_message(object)`: 原始消息对象, 包含所有消息的原始数据(平台适配器发来的) 26 | 10. `timestamp(int)`: 消息的时间戳(会自动初始化) 27 | -------------------------------------------------------------------------------- /dev/star/resources/context.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | ## Context 6 | 7 | 暴露给插件的上下文, 该类的作用就是为插件提供接口和数据。 8 | 9 | ### 属性: 10 | 11 | 1. `provider_manager`: 供应商管理器对象 12 | 2. `platform_manager`: 平台管理器对象 13 | 14 | ### 方法: 15 | 16 | #### 插件相关 17 | 18 | 1. get_registered_star 19 | 20 | ```Python 21 | get_registered_star(star_name: str) -> StarMetadata 22 | ``` 23 | 24 | 该方法根据输入的插件名获取插件的元数据对象, 该对象包含了插件的基本信息, 例如插件的名称、版本、作者等。 25 | 该方法可以获取其他插件的元数据。 26 | StarMetadata 详情见[StarMetadata](/dev/star/resources/star_metadata.md) 27 | 28 | 2. get_all_stars 29 | 30 | ```Python 31 | get_all_stars() -> List[StarMetadata] 32 | ``` 33 | 34 | 该方法获取所有已注册的插件的元数据对象列表, 该列表包含了所有插件的基本信息。 35 | StarMetadata 详情见[StarMetadata](/dev/star/resources/star_metadata.md) 36 | 37 | #### 函数工具相关 38 | 39 | 3. get_llm_tool_manager 40 | 41 | ```Python 42 | get_llm_tool_manager() -> FuncCall 43 | ``` 44 | 45 | 该方法获取 FuncCall 对象, 该对象用于管理注册的所有函数调用工具。 46 | 47 | 4. activate_llm_tool 48 | 49 | ```Python 50 | activate_llm_tool(name: str) -> bool 51 | ``` 52 | 53 | 该方法用于激活指定名称的**已经注册**的函数调用工具, 已注册的函数调用工具**默认为激活状态**, 不需要手动激活。 54 | 如果没能找到指定的函数调用工具, 则返回`False`。 55 | 56 | 5. deactivate_llm_tool 57 | 58 | ```Python 59 | deactivate_llm_tool(name: str) -> bool 60 | ``` 61 | 62 | 该方法用于停用指定名称的**已经注册**的函数调用工具。 63 | 如果没能找到指定的函数调用工具, 则返回`False`。 64 | 65 | #### 供应商相关 66 | 67 | 6. register_provider 68 | 69 | ```Python 70 | register_provider(provider: Provider) 71 | ``` 72 | 73 | 该方法用于注册一个新**用于文本生成的**的供应商对象, 该对象必须是 Provider 类。 74 | **用于文本生成的**的 Provider 类型为 Chat_Completion, 后面将不再重复。 75 | 76 | 7. get_provider_by_id 77 | 78 | ```Python 79 | get_provider_by_id(provider_id: str) -> Provider 80 | ``` 81 | 82 | 该方法根据输入的供应商 ID 获取供应商对象。 83 | 84 | 8. get_all_providers 85 | 86 | ```Python 87 | get_all_providers() -> List[Provider] 88 | ``` 89 | 90 | 该方法获取所有已注册的**用于文本生成的**供应商对象列表。 91 | 92 | 9. get_all_tts_providers 93 | 94 | ```Python 95 | get_all_tts_providers() -> List[TTSProvider] 96 | ``` 97 | 98 | 该方法获取所有已注册的**文本到语音**供应商对象列表。 99 | 100 | 10. get_all_stt_providers 101 | 102 | ```Python 103 | get_all_stt_providers() -> List[STTProvider] 104 | ``` 105 | 106 | 该方法获取所有已注册的**语音到文本**供应商对象列表。 107 | 108 | 11. get_using_provider 109 | 110 | ```Python 111 | get_using_provider() -> Provider 112 | ``` 113 | 114 | 该方法获取当前使用的**用于文本生成的**供应商对象。 115 | 116 | 12. get_using_tts_provider 117 | 118 | ```Python 119 | get_using_tts_provider() -> TTSProvider 120 | ``` 121 | 122 | 该方法获取当前使用的**文本到语音**供应商对象。 123 | 124 | 13. get_using_stt_provider 125 | 126 | ```Python 127 | get_using_stt_provider() -> STTProvider 128 | ``` 129 | 130 | 该方法获取当前使用的**语音到文本**供应商对象。 131 | 132 | #### 其他 133 | 134 | 14. get_config 135 | 136 | ```Python 137 | get_config() -> AstrBotConfig 138 | ``` 139 | 140 | 该方法获取当前 AstrBot 的配置对象, 该对象包含了插件的所有配置项与 AstrBot Core 的所有配置项(谨慎修改!)。 141 | 142 | 15. get_db 143 | 144 | ```Python 145 | get_db() -> BaseDatabase 146 | ``` 147 | 148 | 该方法获取 AstrBot 的数据库对象, 该对象用于访问数据库, 该对象是 BaseDatabase 类的实例。 149 | 150 | 16. get_event_queue 151 | 152 | ```Python 153 | get_event_queue() -> Queue 154 | ``` 155 | 156 | 该方法用于获取 AstrBot 的事件队列, 这是一个异步队列, 其中的每一项都是一个 AstrMessageEvent 对象。 157 | 158 | 17. get_platform 159 | 160 | ```Python 161 | get_platform(platform_type: Union[PlatformAdapterType, str]) -> Platform 162 | ``` 163 | 164 | 该方法用于获取指定类型的平台适配器对象。 165 | 166 | 18. send_message 167 | 168 | ```Python 169 | send_message(session: Union[str, MessageSesion], message_chain: MessageChain) -> bool 170 | ``` 171 | 172 | 该方法可以根据会话的唯一标识符-session(unified_msg_origin)主动发送消息。 173 | 174 | 它接受两个参数: 175 | 176 | - session: 会话的唯一标识符, 可以是字符串或 MessageSesion 对象, 获取该标识符参考:[获取会话的 session]。 177 | - message_chain: 消息链对象, 该对象包含了要发送的消息内容, 该对象是 MessageChain 类的实例。 178 | 179 | 该方法返回一个布尔值, 表示是否找到对应的消息平台。 180 | 181 | - **注意: 该方法不支持 qq_official 平台!!** 182 | -------------------------------------------------------------------------------- /dev/star/resources/message_member.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # MessageMember 6 | 7 | 消息发送者对象, 用于标记一个消息发送者的最基本信息 8 | 9 | ### 属性 10 | 11 | 1. `user_id(str)`: 消息发送者 id, 唯一, 例如在 aiocqhttp 平台, 它是发送者的 qq 号 12 | 2. `nickname(str)`: 昵称, 例如在 aiocqhttp 平台, 它是发送者的 qq 昵称, 它会被自动初始化 13 | -------------------------------------------------------------------------------- /dev/star/resources/message_type.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # MessageType 6 | 7 | 消息类型, 用于区分消息是私聊还是群聊消息, 继承自`Enum`枚举类型 8 | 9 | 使用方法如下: 10 | 11 | ```Python 12 | from astrbot.api import MessageType 13 | print(MessageType.GROUP_MESSAGE) 14 | ``` 15 | 16 | ### 内容 17 | 18 | 1. `GROUP_MESSAGE`: 群聊消息 19 | 2. `FRIEND_MESSAGE`: 私聊消息 20 | 3. `OTHER_MESSAGE`: 其他消息, 例如系统消息等 21 | -------------------------------------------------------------------------------- /dev/star/resources/platform_metadata.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # PlatformMetadata 6 | 7 | 平台元数据, 包含了平台的基本信息, 例如平台名称, 平台类型等. 8 | 9 | ### 属性 10 | 11 | 1. `name(str)`: 平台的名称 12 | 2. `description(str)`: 平台的描述 13 | 3. `id(str)`: 平台的唯一标识符, 用于区分不同的平台 14 | 4. `default_config_tmpl(dict)`: 平台的默认配置模板, 用于生成平台的默认配置文件 15 | 5. `adapter_display_name(str)`: 显示在 WebUI 中的平台名称, 默认为 `name`(可以更改) 16 | -------------------------------------------------------------------------------- /dev/star/resources/star.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | ## Star 6 | 7 | 插件的基类, **所有插件都继承于该类**, 拥有该类的所有属性和方法。 8 | 9 | ### 属性: 10 | 11 | 1. `context`: 暴露给插件的上下文, 参考: [Context](/dev/star/resources/context.md) 12 | 13 | ### 方法: 14 | 15 | #### 文转图 16 | 17 | 1. text_to_image 18 | 19 | ```Python 20 | text_to_image(text: str, return_url=True) -> str 21 | ``` 22 | 23 | 该方法用于**将文本转换为图片**, 如果你的插件想实现类似功能, 优先考虑使用该方法。 24 | 25 | 它接受两个参数: 26 | 27 | - text: 你想转换为图片的文本信息, 它是一个字符串, 推荐使用多行字符串的形式。 28 | - return_url: 返回图片链接(True)或文件路径(False)。 29 | 30 | #### html 渲染 31 | 32 | 2. html_render 33 | 34 | ```Python 35 | html_render(tmpl: str, data: dict, return_url=True) -> str 36 | ``` 37 | 38 | 该方法用于**渲染 HTML 代码**, 如果你的插件想实现类似功能, 优先考虑使用该方法。 39 | 40 | 它接受三个参数: 41 | 42 | - tmpl: HTML Jinja2 模板 43 | - data: jinja2 模板数据 44 | - return_url: 返回渲染后的图片 URL(True)或文件路径(False)。 45 | - 46 | 47 | 如果你不知道如何构造模板, 请参考: [Jinja2 文档](https://docs.jinkan.org/docs/jinja2/) 48 | 49 | #### 终止 50 | 51 | 3. terminate(Abstract) 52 | 53 | > 该方法为基类提供的抽象方法, 你需要在自己的插件中实现该方法!! 54 | 55 | 该方法用于插件禁用、重载, 或关闭 AstrBot 时触发, 用于释放插件资源, 如果你的插件对 AstrBot 本体做了某些更改(例如修改了 System Prompt), 强烈建议在该方法中恢复对应的修改!! 如果你的插件使用了外部进程, 强烈建议在该方法中进行销毁!! 56 | 57 | 你需要在你的插件类中如此实现该方法: 58 | 59 | ```Python 60 | async def terminate(self): 61 | """ 62 | 此处实现你的对应逻辑, 例如销毁, 释放某些资源, 回滚某些修改。 63 | """ 64 | ``` 65 | -------------------------------------------------------------------------------- /dev/star/resources/star_metadata.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | ## StarMetadata 6 | 7 | 插件的元数据。 8 | 9 | ### 属性: 10 | 11 | #### 基础属性 12 | 13 | 1. `name(str)`: 插件名称 14 | 2. `author(str)`: 插件作者 15 | 3. `desc(str)`: 插件简介 16 | 4. `version(str)`: 插件版本 17 | 5. `repo(str)`: 插件仓库地址 18 | #### 插件类, 模块属性 19 | 20 | 6. `star_cls_type(type)`: 插件类对象类型, 例如你的插件类名为`HelloWorld`, 该属性就是`` 21 | 7. `star_cls(object)`: 插件的类对象, 它是一个实例, 你可以使用它调用插件的方法和属性 22 | 8. `module_path(str)`: 插件模块的路径 23 | 9. `module(ModuleType)`: 插件的模块对象 24 | 10. `root_dir_name(str)`: 插件的目录名称 25 | 26 | #### 插件身份&状态属性 27 | 28 | 11. `reserved(bool)`: 是否为 AstrBot 保留插件 29 | 12. `activated(bool)`: 是否被激活 30 | 31 | #### 插件配置 32 | 33 | 13. `config(AstrBotConfig)`: 插件配置对象 34 | 35 | #### 注册的 Handler 全名列表 36 | 37 | 14. `star_handler_full_names(List(str))`: 注册的 Handler 全名列表, Handler 相关请见核心代码解释->插件注册(施工中) 38 | 39 | #### 其它 40 | 41 | 该类实现了`__str__`方法, 因此你可以打印插件信息。 42 | -------------------------------------------------------------------------------- /faq.md: -------------------------------------------------------------------------------- 1 | # FAQ 2 | 3 | ## 管理面板相关 4 | 5 | ### 当管理面板打开时遇到 404 错误 6 | 7 | 在 [release](https://github.com/AstrBotDevs/AstrBot/releases) 页面下载 `dist.zip`,解压拖到 `AstrBot/data` 下。还不行请重启电脑(来自群里的反馈) 8 | 9 | ### 管理面板的密码忘记了 10 | 11 | 如果你忘记了 AstrBot 的管理面板的密码, 你可以在`AstrBot/data/cmd_config.json`配置文件中找到`"dashboard"`字段进行修改, 12 | 其中`"username"`是你的用户名, `"password"`是你的密码, 经过 md5 加密。 13 | 14 | 如果想要修改账号密码, 你可以这样做: 15 | 16 | 1. 修改`"username"`字段, 注意保留`""`, 如果不想修改用户名, 可以不修改 17 | 2. 进入网站:[在线 md5 生成](https://www.metools.info/code/c26.html) 18 | 3. 在转换前文本框输入你的新密码 19 | 4. 选择 MD5 加密(32 位), 请确认选择 32 位选项 20 | 5. 将转换后的字符粘贴至配置文件, 注意保留`""` 21 | 22 | ## Bot 本体相关 23 | 24 | ### 机器人在群聊无法聊天 25 | 26 | 1. 群聊情况下,由于防止消息泛滥,不会对每条监听到的消息都回复,请尝试 @ 机器人或者使用唤醒词来聊天,比如默认的 `/`,输入 `/你好`。 27 | 28 | ### 没有权限操作管理员指令 29 | 30 | 1. `/reset, /persona, /dashboard_update, /op, /deop, /wl, /dewl` 是默认的管理员指令。可以通过 `/sid` 指令得到用户的 ID,然后在配置->其他配置中添加到管理员 ID 名单中。 31 | 32 | ### 本地渲染 Markdown 图片(t2i)时中文乱码 33 | 34 | 可以自定义字体。详见 -> [#957](https://github.com/AstrBotDevs/AstrBot/issues/957#issuecomment-2749981802) 35 | 36 | 推荐 [Maple Mono](https://github.com/subframe7536/maple-font) 字体。 37 | 38 | ### API 返回的 completion 无法解析 & llm 返回`` 39 | 40 | 这是由于供应商的 API 返回了空文本, 尝试以下步骤: 41 | 42 | 1. 检查 API-key 是否仍然有效 43 | 2. 检查是否达到 API 调用限制或配额 44 | 3. 检查网络连接 45 | 4. 尝试 reset 46 | 5. 降低最大对话次数设置 47 | 6. 切换使用同一供应商的其他模型/不同供应商的模型 48 | 49 | ## 插件相关 50 | 51 | ### 插件安装不上 52 | 53 | 1. 插件通过 github 安装,在国内访问 github 确实有时候连不上。可以挂代理,然后进 其他配置->HTTP 代理 设置代理。或者直接下载插件压缩包,然后上传。 54 | 55 | ### 安装插件后报错 `No module named 'xxx'` 56 | 57 | ![](source/images/faq/image.png) 58 | 59 | 这个是因为插件依赖的库没有被正常安装。一般情况下,AstrBot 会在安装好插件后自动为插件安装依赖库,如果出现了以下情况可能造成安装失败: 60 | 61 | 1. 网络问题导致依赖库无法下载 62 | 2. 插件作者没有填写 `requirements.txt` 文件 63 | 3. Python 版本不兼容 64 | 65 | 解决方法: 66 | 67 | 结合报错信息,参考插件的 README 手动安装依赖库。您可在 AstrBot WebUI 的 `控制台`->`安装 Pip 库` 中安装依赖库。 68 | 69 | ![](source/images/faq/image-1.png) 70 | 71 | 如果发现插件作者没有填写 `requirements.txt` 文件,请在插件仓库提交 issue,提醒作者补充。 72 | -------------------------------------------------------------------------------- /index.md: -------------------------------------------------------------------------------- 1 | --- 2 | # https://vitepress.dev/reference/default-theme-home-page 3 | layout: home 4 | 5 | hero: 6 | name: "AstrBot" 7 | text: "易于上手的多平台聊天机器人及开发框架。" 8 | tagline: 松耦合 / 异步 / 多消息平台部署 / 易用的插件系统 / 完善的大语言模型(LLM)接入 9 | image: 10 | src: https://cf.s3.soulter.top/astrbot-logo.svg 11 | alt: AstrBot Logo 12 | actions: 13 | - theme: brand 14 | text: 快速开始 15 | link: /what-is-astrbot 16 | - theme: alt 17 | text: GitHub 仓库 18 | link: https://github.com/AstrBotDevs/AstrBot 19 | 20 | features: 21 | - icon: ✨ 22 | title: 多平台支持 23 | details: 同时支持 QQ、QQ频道、微信、Telegram 等多种消息平台多实例部署。 24 | - icon: 😌 25 | title: 易于上手 26 | details: 支持通过 Docker、Windows 一键安装器部署,无需复杂的配置。配备高度可视化的管理面板。 27 | - icon: 🧩 28 | title: 高扩展性 29 | details: 基于事件总线和流水线的架构设计,完全模块化。所有功能都可以开启或关闭,还支持插件开发。 30 | - icon: 🌟 31 | title: 大语言模型 32 | details: 适配 OpenAI、Anthropic、Ollama、智谱、Deepseek、LLMTuner 等多个模型提供商,支持多种大语言模型接入。 33 | --- 34 | 35 | -------------------------------------------------------------------------------- /ospp/2025.md: -------------------------------------------------------------------------------- 1 | # 开源之夏 2025 2 | 3 | **开源之夏**是由中国科学院软件研究所“开源软件供应链点亮计划”发起并长期支持的一项暑期开源活动,旨在鼓励在校学生积极参与开源软件的开发维护,培养和发掘更多优秀的开发者,促进优秀开源软件社区的蓬勃发展,助力开源软件供应链建设。具体活动信息请参考 [开源之夏官网](https://summer-ospp.ac.cn/)。 4 | 5 | AstrBot 社区有幸作为开源社区参与了本次活动,下面列出了目前我们已经发布的项目,欢迎感兴趣的同学们参与。 6 | 7 | ## 插件数据存储逻辑优化 8 | 9 | 目前,AstrBot 插件系统在数据存储方面缺乏一致的架构。部分插件使用 SharedPreference 存储机制和 JSON 格式进行数据持久化。这种多样化的存储方式导致了存储逻辑的不统一,既影响了数据的安全性,也增加了插件间的兼容性问题。此外,缺乏标准化的接口使得插件的数据存储和访问方式各异,给系统的维护和扩展带来挑战。本项目旨在重构当前存储方案,引入更安全且高效的数据存储机制,并设计一个统一的插件数据接口模型,规范插件的数据存储与访问,提升系统的安全性、可扩展性和可维护性,为未来插件的开发与管理提供坚实基础。 10 | 11 | **项目链接**:[插件数据存储逻辑优化](https://summer-ospp.ac.cn/org/prodetail/253550342?lang=zh&list=pro) 12 | 13 | **难度**:进阶 14 | 15 | **导师**:[Soulter](https://github.com/Soulter) 16 | 17 | **期望完成时间**:210 小时 18 | 19 | **项目产出要求**: 20 | 21 | 1. 设计并实现统一且高效的插件数据存储接口模型,规范插件的数据存储; 22 | 2. 重构当前 SharedPreference 的存储逻辑,采用更安全的存储方式; 23 | 3. 补充相关技术文档。 24 | 25 | **项目技术要求**: 26 | 27 | 1. 熟悉 Python、Javascript 语言及 asyncio 异步编程技术; 28 | 2. 熟悉 SQLite 等关系型数据库相关开发; 29 | 3. 熟悉 AstrBot 框架及插件开发。 30 | 31 | **成果仓库**:[https://github.com/AstrBotDevs/AstrBot](https://github.com/AstrBotDevs/AstrBot) 32 | -------------------------------------------------------------------------------- /others/dashscope.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/others/dashscope.md -------------------------------------------------------------------------------- /others/github-proxy.md: -------------------------------------------------------------------------------- 1 | # 自建 GitHub 加速服务 2 | 3 | 如果发现升级 AstrBot、安装/更新插件时总是因为网络问题安装失败,您可以通过自建 GitHub 加速服务来实现高速访问。 4 | 5 | ![](../source/images/github-proxy/image.png) 6 | 7 | ## 使用 `lxfight/astrbot2github` 自建加速服务 8 | 9 | > 预计部署用时: `2` 分钟 10 | 11 | 0. 打开 [lxfight/astrbot2github](https://github.com/lxfight/astrbot2github) 12 | 1. **(可选但推荐)** 给本项目点个 [**Star ⭐**](https://github.com/lxfight/astrbot2github),你的支持是作者更新和维护的动力! 13 | 2. **Fork 本项目**: 点击页面右上角的 [**Fork**](https://github.com/lxfight/astrbot2github/fork) 按钮,将此项目复刻到你自己的 GitHub 账号下。 14 | 3. **登录 Deno Deploy**: 访问 [Deno Deploy](https://dash.deno.com/) 并使用你的 GitHub 账号登录。 15 | 4. **创建新项目**: 16 | * 点击 **New Project** (或 **新建项目**)。 17 | * 选择 **Deploy from GitHub repository** (带有 GitHub 图标的那个选项)。 18 | * 授权 Deno Deploy 访问你的 GitHub 仓库。 19 | 5. **选择仓库**: 在仓库列表中,选择刚刚 Fork 的 `astrbot2github` 项目。 20 | 6. **配置部署**: 21 | * **Production Branch**: 保持默认 (`main`) 即可。 22 | * **Entrypoint**: **这是关键步骤!** 点击下拉框,找到并选择 `deno_index.ts` 文件作为入口点。 23 | * **Project Name**: Deno 会自动生成一个项目名称,这将是你的服务地址的一部分。你可以保留自动生成的名称 (例如 `fluffy-donkey-12`),也可以自定义名称 (例如 `my-astrbot-proxy`)。 24 | 7. **开始部署**: 确认设置无误后,点击 **Link** 或 **Deploy** 按钮。稍等片刻即可完成。 25 | 8. **获取服务地址**: 部署成功后,页面会显示你的服务地址,格式为 `https://<第6步设置的项目名>.deno.dev`。复制这个地址。 26 | 9. **配置 AstrBot**: 27 | * 回到你的 AstrBot WebUI。 28 | * 进入 **设置 (Settings)** 页面。 29 | * 找到 **GitHub 加速地址 (GitHub Proxy)** 30 | * 将**第 8 步**复制的 Deno 服务地址完整粘贴进去。 31 | 32 | 🎉 **完成!** 现在 AstrBot 在访问插件市场和下载插件时,将会通过你刚刚部署的 Deno 服务进行代理。 33 | -------------------------------------------------------------------------------- /others/platform.md: -------------------------------------------------------------------------------- 1 | # 消息平台适配器 2 | 3 | ## aiocqhttp 4 | 5 | ```json{2,3,4} 6 | { 7 | "id": "default", 8 | "type": "aiocqhttp", 9 | "enable": false, 10 | "ws_reverse_host": "", 11 | "ws_reverse_port": 6199 12 | } 13 | ``` 14 | 15 | 其中,高亮的配置项是所有的适配器配置都有的配置项,`id` 是适配器的唯一标识符,`type` 是适配器的类型,`enable` 是适配器是否启用的标志。 16 | 17 | - `ws_reverse_host` 反向 WebSocket 的主机地址。 18 | - `ws_reverse_port` 反向 WebSocket 的端口。 19 | 20 | ## qqofficial 21 | 22 | ```json 23 | { 24 | "id": "default", 25 | "type": "qq_official", 26 | "enable": false, 27 | "appid": "", 28 | "secret": "", 29 | "enable_group_c2c": true, 30 | "enable_guild_direct_message": true 31 | } 32 | ``` 33 | 34 | - `appid` QQ 官方机器人的 appid。 35 | - `secret` QQ 官方机器人的 secret。 36 | - `enable_group_c2c` 是否启用 QQ 私聊。 37 | - `enable_guild_direct_message` 是否启用 QQ 群聊。 38 | 39 | ## vchat 40 | 41 | ```json 42 | { 43 | "id": "default", 44 | "type": "vchat", 45 | "enable": false 46 | } 47 | ``` -------------------------------------------------------------------------------- /others/provider.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # 大语言模型提供商 6 | 7 | 本页的配置在 `data/cmd_config.json` 的 `provider` 字段中。 8 | 9 | `provider` 字段的值是一个`列表`,列表中的每个元素都是一个类似下面的大语言模型提供商的配置。只需将其添加到列表中即可。 10 | 11 | > [!TIP] 12 | > 使用 `/provider` 指令可以查看、切换大语言模型提供商。 13 | > 14 | > 使用 `/model` 指令可以查看、切换提供商支持的模型。(需要提供商适配) 15 | 16 | 下面所有的配置都可在管理面板可视化配置: 17 | 18 | ![](../source/images/provider/image.png) 19 | 20 | ## OpenAI Chat Completion 21 | 22 | 适配了 OpenAI Chat Completion 接口的配置。 23 | 24 | ```json 25 | { 26 | "id": "default", 27 | "type": "openai_chat_completion", 28 | "enable": true, 29 | "key": [], 30 | "api_base": "", 31 | "model_config": { 32 | "model": "gpt-4o-mini" 33 | } 34 | } 35 | ``` 36 | 37 | - `key` API Key。可以填写多个,以便在一个 API Key 被限制时切换到另一个。格式如 `["key1", "key2"]`。 38 | 39 | - `api_base` API Base URL。默认为空。为空时使用 OpenAI 官方 API。 40 | 41 | - `model_config` 模型配置。`model` 为模型名称。你可以在这里加入更多的模型配置项,比如 `top_p`、`temperature` 等。但请注意不要填写模型不支持的配置项。 42 | 43 | 很多提供商如 Google Gemini、Deepseek、Ollama、智浦(GLM)、OneAPI 等**都适配了 OpenAI API 接口**。因此它们使用的都是 **openai_chat_completion**。只需修改 `key`, `api_base`, `model_config` 配置项即可。下面列举几个提供商的配置。 44 | 45 | ### Ollama 46 | 47 | ```json{5} 48 | { 49 | "id": "ollama_default", 50 | "type": "openai_chat_completion", 51 | "enable": true, 52 | "key": ["ollama"], 53 | "api_base": "http://localhost:11434/v1", 54 | "model_config": { 55 | "model": "llama3.1-8b" 56 | } 57 | } 58 | ``` 59 | 60 | > 对于 Mac/Windows 使用 Docker Desktop 部署 AstrBot 部署的用户,API Base URL 请填写为 `http://host.docker.internal:11434/v1`。 61 | > 对于 Linux 使用 Docker 部署 AstrBot 部署的用户,API Base URL 请填写为 `http://172.17.0.1:11434/v1`,或者将 `172.17.0.1` 替换为你的公网 IP IP(确保宿主机系统放行了 11434 端口)。 62 | 63 | ollama 的 key 默认是 ollama。 64 | 65 | > [!TIP] 66 | > 1. 部分模型不支持工具调用或者调用效果很差,因此您可能需要手动 /tool ls 得到所有启用的工具,并使用 /tool off 禁用 67 | 68 | ### Gemini 69 | 70 | 对于 Gemini,有两种配置方式。一种是使用 OpenAI 兼容的 API,即 `type` 字段为 `openai_chat_completion`。另一种是使用 Gemini 的专用 API,即 `type` 字段为 `googlegenai_chat_completion`。 71 | 72 | 在管理面板可视化配置时,第一种为 `gemini(OpenAI兼容)`,第二种为 `gemini(googlegenai原生)`。 73 | 74 | 如果你正在使用某些反代项目以在中国大陆使用 Gemini,它们可能不会提供 OpenAI 兼容的API,这时候就需要使用 `gemini(googlegenai原生)`。 75 | 76 | 以第二种方式为例, 77 | 78 | 打开 https://aistudio.google.com/app/apikey 79 | 80 | 首次注册会出现以下页面,选择 Get API key 81 | 82 | ![alt text](../source/images/provider/image-4.png) 83 | 84 | 然后复制生成的 Key 即可。 85 | 86 | 回到 AstrBot,在配置->服务提供商配置处点击 + 号,选择: 87 | 88 | ![](../source/images/provider/image-5.png) 89 | 90 | 粘贴复制的 Key。 91 | 92 | 然后,如果您的网络环境在国内,可能需要在 其他配置->HTTP 代理 配置代理才能正常访问。或者,可以暂时使用这个反代: 93 | 94 | https://dynamic-halva-76bb38.netlify.app/ 95 | 96 | 即在 API Base 处填写上面这个链接即可。 97 | 98 | ```json 99 | { 100 | "id": "gemini_default", 101 | "type": "openai_chat_completion", # 或者 googlegenai_chat_completion。在复制本代码时请把这个注释删掉,否则会报错。 102 | "enable": true, 103 | "key": [], 104 | "api_base": "https://generativelanguage.googleapis.com/v1beta/openai/", # 如果是 googlegenai_chat_completion,这里填写 https://generativelanguage.googleapis.com 或者你的 Gemini(Palm)反代地址。 105 | "model_config": { 106 | "model": "gemini-1.5-flash" 107 | } 108 | } 109 | ``` 110 | 111 | ### Deepseek 112 | 113 | ```json 114 | { 115 | "id": "deepseek_default", 116 | "type": "openai_chat_completion", 117 | "enable": true, 118 | "key": [], 119 | "api_base": "https://api.deepseek.com/v1", 120 | "model_config": { 121 | "model": "deepseek-chat" 122 | } 123 | } 124 | ``` 125 | 126 | ### 智谱 GLM 127 | 128 | glm-4-flash 是智谱的免费模型,可以快速接入测试。 129 | 130 | 首先,注册并登录 https://open.bigmodel.cn/, 131 | 132 | 然后进入:https://open.bigmodel.cn/usercenter/proj-mgmt/apikeys 133 | 134 | 点击右上角的 添加新 API Key: 135 | 136 | ![alt text](../source/images/provider/image-1.png) 137 | 138 | 随便填写一个名称,添加成功后,点击复制: 139 | 140 | ![](../source/images/provider/image-2.png) 141 | 142 | 回到 AstrBot,点击配置、服务提供商配置,点击加号,添加 zhipu: 143 | 144 | ![](../source/images/provider/image-3.png) 145 | 146 | 将刚刚复制的 key 填到 API Key 处然后保存即可。 147 | 148 | 使用 /provider 指令切换到 zhipu。 149 | 150 | ```json 151 | { 152 | "id": "zhipu_default", 153 | "type": "openai_chat_completion", 154 | "enable": true, 155 | "key": [], 156 | "api_base": "https://open.bigmodel.cn/api/paas/v4/", 157 | "model_config": { 158 | "model": "glm-4-flash" 159 | } 160 | } 161 | ``` 162 | 163 | ## LLMTuner 164 | 165 | AstrBot 支持加载使用 `LlamaFactory` 微调的模型。 166 | 167 | ```json 168 | { 169 | "id": "llmtuner_default", 170 | "type": "llm_tuner", 171 | "enable": true, 172 | "base_model_path": "", 173 | "adapter_model_path": "", 174 | "llmtuner_template": "", 175 | "finetuning_type": "lora", 176 | "quantization_bit": 4 177 | } 178 | ``` 179 | 180 | - `base_model_path` 基座模型路径。 181 | - `adapter_model_path` 适配器模型路径。如微调好的 `Lora` 模型。 182 | - `llmtuner_template` 基座模型的类型。如 `llama3`, `qwen`。请参考 `LlamaFactory` 的文档。 183 | - `finetuning_type` 微调类型。如 `lora`。 184 | - `quantization_bit` 量化位数。如 `4`, `8`。 185 | 186 | ## Dify 187 | 188 | AstrBot 支持接入 Dify。 189 | 190 | 请参考 [接入 Dify](/config/providers/dify)。 191 | 192 | 193 | ## Whisper 语音转文字 194 | 195 | AstrBot 支持接入 OpenAI 开源的 Whisper 模型,实现语音转文字。 196 | 197 | 可以接入 API 版本的,也可以在本地部署 Whisper。 198 | 199 | 详见 [Whisper 语音转文字](/use/whisper)。 200 | 201 | 202 | ## OpenAI TTS 文字转语音 203 | 204 | AstrBot 支持接入 OpenAI TTS 模型,实现文字转语音。 205 | 206 | 详见 [OpenAI TTS 文字转语音](/use/tts)。 -------------------------------------------------------------------------------- /others/self-host-t2i.md: -------------------------------------------------------------------------------- 1 | # 自行部署文转图服务 2 | 3 | 在 AstrBot 中,默认使用的文转图服务接口是 4 | 5 | ```plain 6 | https://t2i.soulter.top/text2img 7 | ``` 8 | 9 | 此接口能够保障大部分时间正常响应。但是由于部署在国外的(纽约)服务器,因此响应速度可能会比较慢。 10 | 11 | 可以自行部署文转图服务。 12 | 13 | 文转图服务使用的开源项目:https://github.com/idoknow/CampuxUtility 14 | 15 | ``` 16 | docker run -itd -p 8999:8999 rockchin/campuxutility 17 | ``` 18 | 19 | > 上述 8999 端口可以自行更改。 20 | 21 | 在部署完成后,前往 AstrBot 面板 -> 配置 -> 其他配置,修改`文本转图像服务接口` 为你部署好的 url。 22 | 23 | > 如果部署在与 AstrBot 相同的机器上,url 应该为 `http://localhost:8999`。 24 | 25 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "scripts": { 3 | "docs:dev": "vitepress dev --host", 4 | "docs:build": "vitepress build", 5 | "docs:preview": "vitepress preview" 6 | }, 7 | "devDependencies": { 8 | "vitepress": "^1.6.3" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /source/archive/1logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/archive/1logo.png -------------------------------------------------------------------------------- /source/images/btpanel/image-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/btpanel/image-1.png -------------------------------------------------------------------------------- /source/images/btpanel/image-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/btpanel/image-2.png -------------------------------------------------------------------------------- /source/images/btpanel/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/btpanel/image.png -------------------------------------------------------------------------------- /source/images/casaos/image-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/casaos/image-1.png -------------------------------------------------------------------------------- /source/images/casaos/image-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/casaos/image-2.png -------------------------------------------------------------------------------- /source/images/casaos/image-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/casaos/image-3.png -------------------------------------------------------------------------------- /source/images/casaos/image-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/casaos/image-4.png -------------------------------------------------------------------------------- /source/images/casaos/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/casaos/image.png -------------------------------------------------------------------------------- /source/images/cli/image-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/cli/image-1.png -------------------------------------------------------------------------------- /source/images/cli/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/cli/image.png -------------------------------------------------------------------------------- /source/images/code-interpreter/a3cd3a0e-aca5-41b2-aa52-66b568bd955b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/code-interpreter/a3cd3a0e-aca5-41b2-aa52-66b568bd955b.png -------------------------------------------------------------------------------- /source/images/code-interpreter/image-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/code-interpreter/image-1.png -------------------------------------------------------------------------------- /source/images/code-interpreter/image-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/code-interpreter/image-2.png -------------------------------------------------------------------------------- /source/images/code-interpreter/image-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/code-interpreter/image-3.png -------------------------------------------------------------------------------- /source/images/code-interpreter/image-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/code-interpreter/image-4.png -------------------------------------------------------------------------------- /source/images/code-interpreter/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/code-interpreter/image.png -------------------------------------------------------------------------------- /source/images/dashscope/image-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/dashscope/image-1.png -------------------------------------------------------------------------------- /source/images/dashscope/image-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/dashscope/image-2.png -------------------------------------------------------------------------------- /source/images/dashscope/image-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/dashscope/image-3.png -------------------------------------------------------------------------------- /source/images/dashscope/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/dashscope/image.png -------------------------------------------------------------------------------- /source/images/dev/overall_structure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/dev/overall_structure.png -------------------------------------------------------------------------------- /source/images/dify/image-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/dify/image-1.png -------------------------------------------------------------------------------- /source/images/dify/image-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/dify/image-2.png -------------------------------------------------------------------------------- /source/images/dify/image-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/dify/image-3.png -------------------------------------------------------------------------------- /source/images/dify/image-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/dify/image-4.png -------------------------------------------------------------------------------- /source/images/dify/image-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/dify/image-5.png -------------------------------------------------------------------------------- /source/images/dify/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/dify/image.png -------------------------------------------------------------------------------- /source/images/dingtalk/image-10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/dingtalk/image-10.png -------------------------------------------------------------------------------- /source/images/dingtalk/image-11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/dingtalk/image-11.png -------------------------------------------------------------------------------- /source/images/dingtalk/image-12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/dingtalk/image-12.png -------------------------------------------------------------------------------- /source/images/dingtalk/image-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/dingtalk/image-4.png -------------------------------------------------------------------------------- /source/images/dingtalk/image-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/dingtalk/image-5.png -------------------------------------------------------------------------------- /source/images/dingtalk/image-6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/dingtalk/image-6.png -------------------------------------------------------------------------------- /source/images/dingtalk/image-7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/dingtalk/image-7.png -------------------------------------------------------------------------------- /source/images/dingtalk/image-8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/dingtalk/image-8.png -------------------------------------------------------------------------------- /source/images/dingtalk/image-9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/dingtalk/image-9.png -------------------------------------------------------------------------------- /source/images/docker/image-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/docker/image-1.png -------------------------------------------------------------------------------- /source/images/docker/image-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/docker/image-2.png -------------------------------------------------------------------------------- /source/images/docker/image-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/docker/image-3.png -------------------------------------------------------------------------------- /source/images/docker/image-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/docker/image-4.png -------------------------------------------------------------------------------- /source/images/docker/image-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/docker/image-5.png -------------------------------------------------------------------------------- /source/images/docker/image-6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/docker/image-6.png -------------------------------------------------------------------------------- /source/images/docker/image-7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/docker/image-7.png -------------------------------------------------------------------------------- /source/images/docker/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/docker/image.png -------------------------------------------------------------------------------- /source/images/faq/image-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/faq/image-1.png -------------------------------------------------------------------------------- /source/images/faq/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/faq/image.png -------------------------------------------------------------------------------- /source/images/function-calling/image-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/function-calling/image-1.png -------------------------------------------------------------------------------- /source/images/function-calling/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/function-calling/image.png -------------------------------------------------------------------------------- /source/images/function-calling/image2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/function-calling/image2.png -------------------------------------------------------------------------------- /source/images/function-calling/image3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/function-calling/image3.png -------------------------------------------------------------------------------- /source/images/gewechat/image-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/gewechat/image-1.png -------------------------------------------------------------------------------- /source/images/gewechat/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/gewechat/image.png -------------------------------------------------------------------------------- /source/images/github-proxy/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/github-proxy/image.png -------------------------------------------------------------------------------- /source/images/knowledge-base/QQ_1748619436297.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/knowledge-base/QQ_1748619436297.png -------------------------------------------------------------------------------- /source/images/knowledge-base/QQ_1748619486233.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/knowledge-base/QQ_1748619486233.png -------------------------------------------------------------------------------- /source/images/knowledge-base/QQ_1748619867978.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/knowledge-base/QQ_1748619867978.png -------------------------------------------------------------------------------- /source/images/knowledge-base/QQ_1748619964591.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/knowledge-base/QQ_1748619964591.png -------------------------------------------------------------------------------- /source/images/knowledge-base/QQ_1748620019676.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/knowledge-base/QQ_1748620019676.png -------------------------------------------------------------------------------- /source/images/knowledge-base/QQ_1748620695533.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/knowledge-base/QQ_1748620695533.png -------------------------------------------------------------------------------- /source/images/lark/image-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/lark/image-1.png -------------------------------------------------------------------------------- /source/images/lark/image-10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/lark/image-10.png -------------------------------------------------------------------------------- /source/images/lark/image-11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/lark/image-11.png -------------------------------------------------------------------------------- /source/images/lark/image-12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/lark/image-12.png -------------------------------------------------------------------------------- /source/images/lark/image-13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/lark/image-13.png -------------------------------------------------------------------------------- /source/images/lark/image-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/lark/image-2.png -------------------------------------------------------------------------------- /source/images/lark/image-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/lark/image-3.png -------------------------------------------------------------------------------- /source/images/lark/image-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/lark/image-4.png -------------------------------------------------------------------------------- /source/images/lark/image-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/lark/image-5.png -------------------------------------------------------------------------------- /source/images/lark/image-6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/lark/image-6.png -------------------------------------------------------------------------------- /source/images/lark/image-7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/lark/image-7.png -------------------------------------------------------------------------------- /source/images/lark/image-8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/lark/image-8.png -------------------------------------------------------------------------------- /source/images/lark/image-9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/lark/image-9.png -------------------------------------------------------------------------------- /source/images/lark/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/lark/image.png -------------------------------------------------------------------------------- /source/images/linux-one/5bae97bb68f367923f63dd3f1607a7df.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/linux-one/5bae97bb68f367923f63dd3f1607a7df.png -------------------------------------------------------------------------------- /source/images/llm/image-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/llm/image-1.png -------------------------------------------------------------------------------- /source/images/llm/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/llm/image.png -------------------------------------------------------------------------------- /source/images/logo_deprecated.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 24 | 25 | 30 | 31 | 33 | 34 | 35 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /source/images/logo_prod.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/logo_prod.png -------------------------------------------------------------------------------- /source/images/model-config/image-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/model-config/image-2.png -------------------------------------------------------------------------------- /source/images/model-config/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/model-config/image.png -------------------------------------------------------------------------------- /source/images/napcat/image-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/napcat/image-1.png -------------------------------------------------------------------------------- /source/images/napcat/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/napcat/image.png -------------------------------------------------------------------------------- /source/images/oneapi/image-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/oneapi/image-1.png -------------------------------------------------------------------------------- /source/images/oneapi/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/oneapi/image.png -------------------------------------------------------------------------------- /source/images/plugin-platform-adapter/QQ_1738155926221.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/plugin-platform-adapter/QQ_1738155926221.png -------------------------------------------------------------------------------- /source/images/plugin-platform-adapter/QQ_1738155982211.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/plugin-platform-adapter/QQ_1738155982211.png -------------------------------------------------------------------------------- /source/images/plugin-platform-adapter/QQ_1738156166893.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/plugin-platform-adapter/QQ_1738156166893.png -------------------------------------------------------------------------------- /source/images/plugin-publish/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/plugin-publish/image.png -------------------------------------------------------------------------------- /source/images/plugin/898a169ae7ed0478f41c0a7d14cb4d64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/plugin/898a169ae7ed0478f41c0a7d14cb4d64.png -------------------------------------------------------------------------------- /source/images/plugin/QQ_1738149538737.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/plugin/QQ_1738149538737.png -------------------------------------------------------------------------------- /source/images/plugin/db93a2bb-671c-4332-b8ba-9a91c35623c2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/plugin/db93a2bb-671c-4332-b8ba-9a91c35623c2.png -------------------------------------------------------------------------------- /source/images/plugin/fcc2dcb472a91b12899f617477adc5c7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/plugin/fcc2dcb472a91b12899f617477adc5c7.png -------------------------------------------------------------------------------- /source/images/plugin/image-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/plugin/image-1.png -------------------------------------------------------------------------------- /source/images/plugin/image-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/plugin/image-2.png -------------------------------------------------------------------------------- /source/images/plugin/image-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/plugin/image-3.png -------------------------------------------------------------------------------- /source/images/plugin/image-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/plugin/image-4.png -------------------------------------------------------------------------------- /source/images/plugin/image-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/plugin/image-5.png -------------------------------------------------------------------------------- /source/images/plugin/image-6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/plugin/image-6.png -------------------------------------------------------------------------------- /source/images/plugin/image-7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/plugin/image-7.png -------------------------------------------------------------------------------- /source/images/plugin/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/plugin/image.png -------------------------------------------------------------------------------- /source/images/ppio/image-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/ppio/image-1.png -------------------------------------------------------------------------------- /source/images/ppio/image-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/ppio/image-2.png -------------------------------------------------------------------------------- /source/images/ppio/image-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/ppio/image-3.png -------------------------------------------------------------------------------- /source/images/ppio/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/ppio/image.png -------------------------------------------------------------------------------- /source/images/provider-model-config/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/provider-model-config/image.png -------------------------------------------------------------------------------- /source/images/provider-ollama/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/provider-ollama/image.png -------------------------------------------------------------------------------- /source/images/provider/image-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/provider/image-1.png -------------------------------------------------------------------------------- /source/images/provider/image-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/provider/image-2.png -------------------------------------------------------------------------------- /source/images/provider/image-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/provider/image-3.png -------------------------------------------------------------------------------- /source/images/provider/image-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/provider/image-4.png -------------------------------------------------------------------------------- /source/images/provider/image-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/provider/image-5.png -------------------------------------------------------------------------------- /source/images/provider/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/provider/image.png -------------------------------------------------------------------------------- /source/images/qqofficial/image-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/qqofficial/image-1.png -------------------------------------------------------------------------------- /source/images/qqofficial/image-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/qqofficial/image-2.png -------------------------------------------------------------------------------- /source/images/qqofficial/image-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/qqofficial/image-3.png -------------------------------------------------------------------------------- /source/images/qqofficial/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/qqofficial/image.png -------------------------------------------------------------------------------- /source/images/telegram/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/telegram/image.png -------------------------------------------------------------------------------- /source/images/tts/image-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/tts/image-1.png -------------------------------------------------------------------------------- /source/images/tts/image-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/tts/image-2.png -------------------------------------------------------------------------------- /source/images/tts/image-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/tts/image-3.png -------------------------------------------------------------------------------- /source/images/tts/image-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/tts/image-4.png -------------------------------------------------------------------------------- /source/images/tts/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/tts/image.png -------------------------------------------------------------------------------- /source/images/vchat/image-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/vchat/image-1.png -------------------------------------------------------------------------------- /source/images/vchat/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/vchat/image.png -------------------------------------------------------------------------------- /source/images/webhook/image-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/webhook/image-1.png -------------------------------------------------------------------------------- /source/images/webhook/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/webhook/image.png -------------------------------------------------------------------------------- /source/images/webui/image-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/webui/image-1.png -------------------------------------------------------------------------------- /source/images/webui/image-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/webui/image-2.png -------------------------------------------------------------------------------- /source/images/webui/image-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/webui/image-3.png -------------------------------------------------------------------------------- /source/images/webui/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/webui/image.png -------------------------------------------------------------------------------- /source/images/wechatpadpro/image-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/wechatpadpro/image-1.png -------------------------------------------------------------------------------- /source/images/wechatpadpro/image-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/wechatpadpro/image-2.png -------------------------------------------------------------------------------- /source/images/wechatpadpro/image-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/wechatpadpro/image-3.png -------------------------------------------------------------------------------- /source/images/wechatpadpro/image-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/wechatpadpro/image-4.png -------------------------------------------------------------------------------- /source/images/wechatpadpro/image-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/wechatpadpro/image-5.png -------------------------------------------------------------------------------- /source/images/wechatpadpro/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/wechatpadpro/image.png -------------------------------------------------------------------------------- /source/images/wecom/3dc9fa61145ab0dd8f56a10295affec8_720.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/wecom/3dc9fa61145ab0dd8f56a10295affec8_720.png -------------------------------------------------------------------------------- /source/images/wecom/image-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/wecom/image-1.png -------------------------------------------------------------------------------- /source/images/wecom/image-10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/wecom/image-10.png -------------------------------------------------------------------------------- /source/images/wecom/image-11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/wecom/image-11.png -------------------------------------------------------------------------------- /source/images/wecom/image-12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/wecom/image-12.png -------------------------------------------------------------------------------- /source/images/wecom/image-13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/wecom/image-13.png -------------------------------------------------------------------------------- /source/images/wecom/image-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/wecom/image-2.png -------------------------------------------------------------------------------- /source/images/wecom/image-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/wecom/image-3.png -------------------------------------------------------------------------------- /source/images/wecom/image-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/wecom/image-4.png -------------------------------------------------------------------------------- /source/images/wecom/image-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/wecom/image-5.png -------------------------------------------------------------------------------- /source/images/wecom/image-6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/wecom/image-6.png -------------------------------------------------------------------------------- /source/images/wecom/image-7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/wecom/image-7.png -------------------------------------------------------------------------------- /source/images/wecom/image-8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/wecom/image-8.png -------------------------------------------------------------------------------- /source/images/wecom/image-9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/wecom/image-9.png -------------------------------------------------------------------------------- /source/images/wecom/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/wecom/image.png -------------------------------------------------------------------------------- /source/images/what-is-astrbot/image-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/what-is-astrbot/image-1.png -------------------------------------------------------------------------------- /source/images/what-is-astrbot/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/what-is-astrbot/image.png -------------------------------------------------------------------------------- /source/images/whisper/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/whisper/image.png -------------------------------------------------------------------------------- /source/images/windows/image-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/windows/image-1.png -------------------------------------------------------------------------------- /source/images/windows/image-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/windows/image-2.png -------------------------------------------------------------------------------- /source/images/windows/image-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/windows/image-3.png -------------------------------------------------------------------------------- /source/images/windows/image-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/windows/image-4.png -------------------------------------------------------------------------------- /source/images/windows/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/source/images/windows/image.png -------------------------------------------------------------------------------- /use/code-interpreter.md: -------------------------------------------------------------------------------- 1 | # 基于 Docker 的代码执行器 2 | 3 | 在 `v3.4.2` 版本及之后,AstrBot 支持代码执行器以强化 LLM 的能力,并实现一些自动化的操作。 4 | 5 | > [!TIP] 6 | > 此功能目前处于实验阶段,可能会有一些问题。如果您遇到了问题,请在 [GitHub](https://github.com/AstrBotDevs/AstrBot/issues) 上提交 issue。欢迎加群讨论:[322154837](https://qm.qq.com/cgi-bin/qm/qr?k=EYGsuUTfe00_iOu9JTXS7_TEpMkXOvwv&jump_from=webapi&authKey=uUEMKCROfsseS+8IzqPjzV3y1tzy4AkykwTib2jNkOFdzezF9s9XknqnIaf3CDft)。 7 | 8 | 如果您要使用此功能,请确保您的机器安装了 `Docker`。因为此功能需要启动专用的 Docker 沙箱环境以执行代码,以防止 LLM 生成恶意代码对您的机器造成损害。 9 | 10 | 11 | ## Linux Docker 启动 AstrBot 12 | 13 | 如果您使用 Docker 部署了 AstrBot,需要多做一些工作。 14 | 15 | 1. 您需要在启动 Docker 容器时,请将 `/var/run/docker.sock` 挂载到容器内部。这样 AstrBot 才能够启动沙箱容器。 16 | 17 | ```bash 18 | sudo docker run -itd -p 6180-6200:6180-6200 -p 11451:11451 -v $PWD/data:/AstrBot/data -v /var/run/docker.sock:/var/run/docker.sock --name astrbot soulter/astrbot:latest 19 | ``` 20 | 21 | 2. 在聊天时使用 `/pi absdir <绝对路径地址>` 设置您宿主机上 AstrBot 的 data 目录的所在目录的绝对路径。 22 | 23 | 例子: 24 | 25 | ![](../source/images/code-interpreter/image-4.png) 26 | 27 | ## Linux 手动源码 启动 AstrBot 28 | 29 | **如果你的 Docker 指令需要 sudo 权限来执行**,那么你需要在启动 AstrBot 时,使用 `sudo` 来启动,否则代码执行器会因为权限不足而无法调用 Docker。 30 | 31 | ```bash 32 | sudo —E python3 main.py 33 | ``` 34 | 35 | ## 使用 36 | 37 | 本功能使用的镜像是 `soulter/astrbot-code-interpreter-sandbox`,您可以在 [Docker Hub](https://hub.docker.com/r/soulter/astrbot-code-interpreter-sandbox) 上查看镜像的详细信息。 38 | 39 | 镜像中提供了常用的 Python 库: 40 | 41 | - Pillow 42 | - requests 43 | - numpy 44 | - matplotlib 45 | - scipy 46 | - scikit-learn 47 | - beautifulsoup4 48 | - pandas 49 | - opencv-python 50 | - python-docx 51 | - python-pptx 52 | - pymupdf 53 | - mplfonts 54 | 55 | 基本上能够实现的任务: 56 | 57 | - 图片编辑 58 | - 网页抓取等 59 | - 数据分析、简单的机器学习 60 | - 文档处理,如读写 Word、PPT、PDF 等 61 | - 数学计算,如画图、求解方程等 62 | 63 | 由于中国大陆无法访问 docker hub,因此如果您的环境在中国大陆,请使用 `/pi mirror` 来查看/设置镜像源。比如,截至本文档编写时,您可以使用 `cjie.eu.org` 作为镜像源。即设置 `/pi mirror cjie.eu.org`。 64 | 65 | 在第一次触发代码执行器时,AstrBot 会自动拉取镜像,这可能需要一些时间。请耐心等待。 66 | 67 | 镜像可能会不定时间更新以提供更多的功能,因此请定期查看镜像的更新。如果需要更新镜像,可以使用 `/pi repull` 命令重新拉取镜像。 68 | 69 | > [!TIP] 70 | > 如果一开始没有正常启动此功能,在启动成功之后,需要执行 `/tool on python_interpreter` 来开启此功能。 71 | > 您可以通过 `/tool ls` 查看所有的工具以及它们的启用状态。 72 | 73 | ![](../source/images/code-interpreter/image-3.png) 74 | 75 | ## 图片和文件的输入 76 | 77 | 代码执行器除了能够识别和处理图片、文字任务,还能够识别您发送的文件,并且能够发送文件。 78 | 79 | v3.4.34 后,使用 `/pi file` 指令开始上传文件。上传文件后,您可以使用 `/pi list` 查看您上传的文件,使用 `/pi clean` 清空您上传的文件。 80 | 81 | 上传的文件将会用于代码执行器的输入。 82 | 83 | 比如您希望对一张图片添加圆角,您可以使用 `/pi file` 上传图片,然后再提问:`请运行代码,对这张图片添加圆角`。 84 | 85 | ## Demo 86 | 87 | ![](../source/images/code-interpreter/a3cd3a0e-aca5-41b2-aa52-66b568bd955b.png) 88 | 89 | ![alt text](../source/images/code-interpreter/image.png) 90 | 91 | ![](../source/images/code-interpreter/image-1.png) 92 | 93 | ![](../source/images/code-interpreter/image-2.png) 94 | -------------------------------------------------------------------------------- /use/command.md: -------------------------------------------------------------------------------- 1 | # 内置指令 2 | 3 | AstrBot 具有很多内置指令,它们通过插件的形式被导入。位于 `packages/astrbot` 目录下。 4 | 5 | 使用 `/help` 可以查看所有内置指令。 -------------------------------------------------------------------------------- /use/function-calling.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # 函数调用(Function-calling) 6 | 7 | ## 简介 8 | 9 | 函数调用旨在提供大模型**调用外部工具的能力**,以此实现 Agentic 的一些功能。 10 | 11 | 比如,问大模型:帮我搜索一下关于“猫”的信息,大模型会调用用于搜索的外部工具,比如搜索引擎,然后返回搜索结果。 12 | 13 | 目前,支持的模型包括但不限于 14 | 15 | - gpt-4 系列(效果最好) 16 | - gemini 2.0 系列(不包含 thinking 类的模型)(效果最好) 17 | - deepseek v3(deepseek-chat) 18 | - llama3 系列(本地部署参数量较小时效果不好) 19 | 20 | 等等。 21 | 22 | 不支持的模型比较常见的有 deepseek-r1, gemini 2.0 的 thinking 类模型等。 23 | 24 | 在 AstrBot 中,默认提供了网页搜索、待办提醒、代码执行器这些工具。很多插件,如: 25 | 26 | - astrbot_plugin_cloudmusic 27 | - astrbot_plugin_bilibili 28 | - ... 29 | 30 | 等在提供传统的指令调用的基础上,也提供了函数调用的功能。 31 | 32 | 相关指令: 33 | 34 | - `/tool ls` 查看当前具有的工具列表 35 | - `/tool on` 开启某个工具 36 | - `/tool off` 关闭某个工具 37 | - `/tool off_all` 关闭所有工具 38 | 39 | 某些模型可能不支持函数调用,会返回诸如 `tool call is not supported`, `function calling is not supported`, `tool use is not supported` 等错误。在大多数情况下,AstrBot 能够检测到这种错误并自动帮您去除函数调用工具。如果你发现某个模型不支持函数调用,也可使用 `/tool off_all` 命令关闭所有工具,然后再次尝试。或者更换为支持函数调用的模型。 40 | 41 | 42 | 下面是一些常见的工具调用 Demo: 43 | 44 | ![](../source/images/function-calling/image.png) 45 | 46 | ![](../source/images/function-calling/image-1.png) 47 | 48 | 49 | ## MCP 50 | 51 | 请前往此文档 [AstrBot - MCP](/use/mcp) 查看。 -------------------------------------------------------------------------------- /use/image-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/use/image-1.png -------------------------------------------------------------------------------- /use/image-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/use/image-2.png -------------------------------------------------------------------------------- /use/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AstrBotDevs/AstrBot-docs/5a78acc52f0446382a40d7b82c654bbd40ee6819/use/image.png -------------------------------------------------------------------------------- /use/knowledge-base.md: -------------------------------------------------------------------------------- 1 | # AstrBot 知识库 2 | 3 | > [!TIP] 4 | > 需要 AstrBot 版本 >= 3.5.13,并且 WebUI 已经同步升级至最新版本。 5 | 6 | ## 简介 7 | 8 | AstrBot 提供了开箱即用的知识库功能。 9 | 10 | ## 安装 11 | 12 | 为了保证主线依赖的精简性,AstrBot 的知识库能力采用插件的形式提供,您需要先安装插件。 13 | 14 | 前往 WebUI,点击 `Alkaid`,进入到 Alkaid 页面,您将看到知识库的选项。 15 | 16 | 如果显示未安装知识库,请先安装知识库插件。点击安装按钮即可,或者前往插件市场安装 `astrbot_plugin_knowledge_base` 插件。由于依赖较大,可能需要安装数分钟,请耐心等待,如果安装过程中发生了错误,请提交 Issue 至 [AstrBot Issues](https://github.com/AstrBotDevs/AstrBot/issues)。 17 | 18 | 安装成功后,您将看到如下界面: 19 | 20 | ![](../source/images/knowledge-base/QQ_1748619436297.png) 21 | 22 | ## 配置嵌入模型 23 | 24 | 打开服务提供商,点击新增服务提供商,选择 Embedding,如下图所示: 25 | 26 | ![](../source/images/knowledge-base/QQ_1748619486233.png) 27 | 28 | 目前 AstrBot 仅支持兼容 OpenAI API 的嵌入向量服务,如 OpenAI、Ollama 等。您可以参考此页 [附录-2 免费的嵌入模型申请](#附录-2免费的嵌入模型申请) 申请免费的嵌入模型。 29 | 30 | 点击上面的提供商卡片进入配置页面,填写配置。 31 | 32 | > [!TIP] 33 | > 请再三确保您所填写的**模型名称**和**嵌入维度**是否正确!常见的维度大小有:768, 1024, 1536, 3072。 34 | 35 | 配置完成后,点击保存。 36 | 37 | ## 创建知识库 38 | 39 | AstrBot 支持多知识库管理。在聊天时,您可以**自由指定知识库**。 40 | 41 | 前往 WebUI,点击 `Alkaid`,进入到 Alkaid 页面,点击创建知识库,如下图所示: 42 | 43 | ![](../source/images/knowledge-base/QQ_1748619867978.png) 44 | 45 | 填写相关信息。在嵌入模型下拉菜单中您将看到刚刚创建好的嵌入模型提供商。 46 | 47 | > [!TIP] 48 | > 一旦选择了一个知识库的嵌入模型,请不要再修改该提供商的**模型**或者**向量维度信息**,否则将**严重影响**该知识库的召回率甚至**报错**。 49 | 50 | 创建好后,如下图所示: 51 | 52 | ![](../source/images/knowledge-base/QQ_1748619964591.png) 53 | 54 | ## 上传文件 55 | 56 | 点击要上传文件的知识库,拖拽或者点击上传您想要导入的文件。**最大的单个上传文件大小暂时为 128 MB。** 57 | 58 | > [!TIP] 59 | > AstrBot 知识库使用 Markitdown 来将非文本文件转换成大模型友好的 Markdown 格式。 60 | > 您可以上传的文件格式如下:md, txt, docx, xlsx, pptx 等等。其中,最兼容的是 md 和 txt。 61 | 62 | 点击上传到知识库即可开始上传。对于大文件,这可能需要一些时间。您可以开一个新的 WebUI 标签页,在控制台处查看进度。如果有报错并且无法解决,请提交 Issue 至 [AstrBot Issues](https://github.com/AstrBotDevs/AstrBot/issues)。 63 | 64 | ![](../source/images/knowledge-base/QQ_1748620019676.png) 65 | 66 | 上传成功时,下方会弹出绿色的提示。 67 | 68 | ## 测试和使用 69 | 70 | 您可以点击 `搜索内容` 立刻开始测试可用性(不会使用 LLM),如下图所示: 71 | 72 | ![](../source/images/knowledge-base/QQ_1748620695533.png) 73 | 74 | 在聊天页面,请使用 `/kb use 知识库名称` 来切换。详细的操作指令可以参考 `/kb help` 75 | 76 | ## 更新知识库插件 77 | 78 | 请定时更新知识库插件,以获得更全面的更新。 79 | 80 | 进入插件管理页面,找到 `astrbot_plugin_knowledge_base` 插件。如果有更新,将会出现黄色的更新标识,点击 `操作` 按钮 -> `更新到...` 即可。 81 | 82 | ## 常见问题 FAQ 83 | 84 | ### 安装知识库时,报错: ImportError: DLL load failed while importing onnxruntime_pybind11_state 85 | 86 | 类似的有: 87 | 88 | - `动态链接库(DLL)初始化例程失败。` 89 | - `系统找不到指定的模块` 90 | - `TypeError: unable to load from type ''` 91 | 92 | 系 markitdown 所依赖的 magica 包依赖的 `onnxruntime` 不兼容您的系统版本导致的问题。 93 | 94 | 解决方案:请更换 `onnxruntime` 版本。在 `控制台->安装 Pip 库` 输入 `onnxruntime==1.16.3`,然后重启 AstrBot。 95 | 96 | 如果还是报错 `onnxruntime` 相关错误,请进入 `https://pypi.org/project/onnxruntime/#history` 找到所有历史版本自行遍历,如 `onnxruntime==1.20.1`,按上述步骤重试。 97 | 98 | ### 打开页面 Alkaid 之后,一片空白 99 | 100 | 如果之前安装过 astrbot_plugin_knowledge_base 插件,需要先更新到 v0.5.2 101 | 102 | ## 反馈 103 | 104 | 这是一个新功能。如果有报错并且无法解决,请提交 Issue 至 [AstrBot Issues](https://github.com/AstrBotDevs/AstrBot/issues)。 105 | 106 | ## 附录 1:Credits 107 | 108 | 1. AstrBot 知识库插件仓库地址:[astrbot_plugin_knowledge_base](https://github.com/lxfight/astrbot_plugin_knowledge_base) 109 | 2. Made with ❤ by **[@lxfight](https://github.com/lxfight)** and [@Soulter](https://github.com/Soulter) and [@Yxiguan](https://github.com/Yxiguan) and [@TheAnyan](https://github.com/TheAnyan). 110 | 111 | ## 附录 2:免费的嵌入模型申请 112 | 113 | ### PPIO 派欧云 114 | 115 | 1. 打开 [PPIO 派欧云官网](https://ppio.cn/user/register?invited_by=AIOONE),并注册账户(通过此链接注册的账户将会获得 15 元人民币的代金券)。 116 | 2. 进入 [模型广场](https://ppio.cn/model-api/console),点击嵌入模型 117 | 3. 点击 BAAI:BGE-M3 (截止至 2025-06-02,该模型在该平台免费)。 118 | 4. 找到 API 接入指南,申请 Key。 119 | 5. 填写 AstrBot OpenAI Embedding 模型提供商配置: 120 | 1. API Key 为刚刚申请的 PPIO 的 API Key 121 | 2. embedding api base 填写 `https://api.ppinfra.com/v3/openai` 122 | 3. model 填写你选择的模型,此例子中为 `baai/bge-m3`。 123 | -------------------------------------------------------------------------------- /use/mcp.md: -------------------------------------------------------------------------------- 1 | # MCP 2 | 3 | MCP(Model Context Protocol,模型上下文协议) 是一种新的开放标准协议,用来在大模型和数据源之间建立安全双向的链接。简单来说,它将函数工具单独抽离出来作为一个独立的服务,AstrBot 通过 MCP 协议远程调用函数工具,函数工具返回结果给 AstrBot。 4 | 5 | ![](../source/images/function-calling/image3.png) 6 | 7 | AstrBot v3.5.0 支持 MCP 协议,可以添加多个 MCP 服务器、使用 MCP 服务器的函数工具。 8 | 9 | ![](../source/images/function-calling/image2.png) 10 | 11 | ## 初始状态配置 12 | 13 | MCP 服务器一般使用 `uv` 或者 `npm` 来启动,因此您需要安装这两个工具。 14 | 15 | 对于 `uv`,您可以直接通过 pip 来安装。可在 AstrBot WebUI 快捷安装: 16 | 17 | ![](image.png) 18 | 19 | 输入 `uv` 即可。 20 | 21 | 如果您使用 Docker 部署 AstrBot,也可以执行以下指令快捷安装。 22 | 23 | ```bash 24 | docker exec astrbot python -m pip install uv 25 | ``` 26 | 27 | 如果您通过源码部署 AstrBot,请在创建的虚拟环境内安装。 28 | 29 | 对于 `npm`,您需要安装 `node`。 30 | 31 | 如果您通过源码/一键安装部署 AstrBot,请参考 [Download Node.js](https://nodejs.org/en/download) 下载到您的本机。 32 | 33 | 如果您使用 Docker 部署 AstrBot,您需要在容器中安装 `node`(后期 AstrBot Docker 镜像将自带 `node`),请参考执行以下指令: 34 | 35 | ```bash 36 | sudo docker exec -it astrbot /bin/bash 37 | apt update && apt install curl -y 38 | export NVM_NODEJS_ORG_MIRROR=http://nodejs.org/dist 39 | # Download and install nvm: 40 | curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.2/install.sh | bash 41 | \. "$HOME/.nvm/nvm.sh" 42 | nvm install 22 43 | # Verify version: 44 | node -v 45 | nvm current 46 | npm -v 47 | npx -v 48 | ``` 49 | 50 | 安装好 `node` 之后,需要重启 `AstrBot` 以应用新的环境变量。 51 | 52 | ## 安装 MCP 服务器 53 | 54 | 如果您使用 Docker 部署 AstrBot,请将 MCP 服务器安装在 data 目录下。 55 | 56 | ### 一个例子 57 | 58 | 我想安装一个查询 Arxiv 上论文的 MCP 服务器,发现了这个 Repo: [arxiv-mcp-server](https://github.com/blazickjp/arxiv-mcp-server),参考它的 README, 59 | 60 | 我们抽取出需要的信息: 61 | 62 | ```json 63 | { 64 | "command": "uv", 65 | "args": [ 66 | "tool", 67 | "run", 68 | "arxiv-mcp-server", 69 | "--storage-path", "data/arxiv" 70 | ] 71 | } 72 | ``` 73 | 74 | 在 AstrBot WebUI 中设置: 75 | 76 | ![](image-2.png) 77 | 78 | 即可。 79 | 80 | 参考链接: 81 | 82 | 1. 在这里了解如何使用 MCP: [Model Context Protocol](https://modelcontextprotocol.io/introduction) 83 | 2. 在这里获取常用的 MCP 服务器: [awesome-mcp-servers](https://github.com/punkpeye/awesome-mcp-servers/blob/main/README-zh.md#what-is-mcp), [Model Context Protocol servers](https://github.com/modelcontextprotocol/servers), [MCP.so](https://mcp.so) 84 | -------------------------------------------------------------------------------- /use/plugin.md: -------------------------------------------------------------------------------- 1 | # AstrBot Star 2 | 3 | 在 `3.4.0` 版本之后,AstrBot 将插件命名为 `Star`。AstrBot 是一个高度模块化的项目,通过插件可以发挥这种模块化的能力,实现各种功能。 4 | 5 | 使用 `/plugin` 可以看到所有插件。在管理面板中也可管理已经安装的插件。 6 | 7 | 如果想自己开发插件,详见 [几行代码实现一个插件](/dev/star/plugin)。 -------------------------------------------------------------------------------- /use/tts.md: -------------------------------------------------------------------------------- 1 | # 使用文字转语音 2 | 3 | > 暂不支持 qq_official,参考 [AstrBot 适配情况](https://github.com/AstrBotDevs/AstrBot?tab=readme-ov-file#-%E6%B6%88%E6%81%AF%E5%B9%B3%E5%8F%B0%E6%94%AF%E6%8C%81%E6%83%85%E5%86%B5) 4 | 5 | AstrBot 目前原生支持接入 OpenAI、Fish Audio TTS 模型,实现文字转语音。也支持适配了 OpenAI TTS API 的第三方 TTS 服务。如果你想使用 OpenAI TTS 服务,你需要一个 OpenAI API Key 或者使用中转服务(推荐 chatanywhere 或者 AiHubMix )。 6 | 7 | ## 配置 OpenAI TTS 8 | 9 | ![](../source/images/tts/image.png) 10 | 11 | 添加,然后填写相关的配置项。 12 | 13 | > [!TIP] 14 | > 如果控制台提示未安装 `whisper` 库,请先点击管理面板->控制台页右上角的 `安装 Pip 库` 按钮安装此库。 15 | 16 | 17 | ## 配置 Fish Audio TTS 18 | 19 | 官网:https://fish-audio.cn/ 20 | 21 | Fish Audio 是一个小样本 TTS, 能快速生成 TTS 语音, 其团队包含了 GPT-Sovits 的创始人。 Fish Audio 还推出了线上 API。 22 | 23 | 首先,请登录官网注册账号,然后进入 [API Key](https://fish-audio.cn/zh-CN/go-api/api-keys/) 申请一个 API Key。 24 | 25 | 进入[账单](https://fish-audio.cn/zh-CN/go-api/billing/),可以找到申请试用额度,点击申请即可,如果没有额度,可以充值。 26 | 27 | 在 AstrBot: 28 | 29 | ![](../source/images/tts/image-2.png) 30 | 31 | 然后填入你的 API Key。 32 | 33 | > [!TIP] 34 | > 如果控制台提示未安装 `ormsgpack` 库,请先点击管理面板->控制台页右上角的 `安装 Pip 库` 按钮安装此库。 35 | 36 | ## 配置 GSVI(GPT-SoVITS-Inference) TTS 37 | 官网:https://github.com/X-T-E-R/GPT-SoVITS-Inference 38 | 39 | GSVI 是一个基于 GPT-SoVITS 构建的推理专用插件,旨在通过用户友好的 API 界面增强您的文本转语音 (TTS) 体验。 40 | 由于原项目 GPT-SoVITS 并不方便提供 API 服务,因此使用的是 GSVI。 41 | 42 | 首先需要部署 GSVI 服务,具体的环境配置步骤请参考 [GSVI 官方文档](https://www.yuque.com/xter/zibxlp/nqi871glgxfy717e)。 43 | > 注:本文档不涉及具体的环境配置步骤。 44 | 45 | 在项目根目录下创建一个`trained`目录,用于存放模型, 46 | 47 | ![](../source/images/tts/image-3.png) 48 | 49 | 将不同的人物存放至不同的文件夹,GSVI 在读取的人物名称就是 trained 目录下的子目录名称,每个人物文件夹下要包括参考音频,GPT 模型,SoVITS 模型以及推理配置文件(infer_config.json)。 50 | 以下是 infer_config.json 的参考配置: 51 | 52 | ```json 53 | { 54 | "gpt_path": "Paimeng.ckpt", 55 | "sovits_path": "Paimeng.pth", 56 | "software_version": "1.1", 57 | "简介": "这是一个配置文件适用于https://github.com/X-T-E-R/TTS-for-GPT-soVITS,是一个简单好用的前后端项目", 58 | "emotion_list": { 59 | "default": { 60 | "ref_wav_path": "说话—既然罗莎莉亚说足迹上有元素力,用元素视野应该能很清楚地看到吧。.wav", 61 | "prompt_text": "说话—既然罗莎莉亚说足迹上有元素力,用元素视野应该能很清楚地看到吧。", 62 | "prompt_language": "多语种混合" 63 | }, 64 | "angry": { 65 | "ref_wav_path": "生气—呜哇好生气啊!不要把我跟一斗相提并论!.wav", 66 | "prompt_text": "呜哇好生气啊!不要把我跟一斗相提并论!", 67 | "prompt_language": "多语种混合" 68 | }, 69 | "excited": { 70 | "ref_wav_path": "激动—好耶!《特尔克西的奇幻历险》出发咯!.wav", 71 | "prompt_text": "好耶!《特尔克西的奇幻历险》出发咯!", 72 | "prompt_language": "多语种混合" 73 | }, 74 | "confused": { 75 | "ref_wav_path": "疑问—哇,这个,还有这个…只是和史莱姆打了一场,就有这么多结论吗?.wav", 76 | "prompt_text": "哇,这个,还有这个…只是和史莱姆打了一场,就有这么多结论吗?", 77 | "prompt_language": "多语种混合" 78 | } 79 | } 80 | } 81 | ``` 82 | 83 | 配置说明: 84 | - `gpt_path`:GPT 模型文件路径 85 | - `sovits_path`:SoVITS 模型文件路径 86 | - `emotion_list`:情绪配置列表,包含各种情绪状态对应的参照文本和音频 87 | 88 | 89 | 完成配置后,执行以下命令启动 API 服务: 90 | ```bash 91 | python pure_api.py 92 | ``` 93 | > 注:使用 pure_api.py 而非 GUI 版本,因为我们只需要 API 功能 94 | 95 | 然后在 AstrBot 中启用, 96 | 97 | ![](../source/images/tts/image-4.png) 98 | 99 | - **API base URL**:GSVI 服务器地址(本地部署使用默认值即可) 100 | - **character**:trained 目录下的角色名称 101 | - **emotion**:对应角色配置中的情绪标识(如 angry、excited 等) 102 | 103 | 104 | 105 | 106 | 107 | ## 启用 TTS 108 | 109 | ![](../source/images/tts/image-1.png) 110 | 111 | 在这里点击启用,然后保存配置。 112 | 113 | 如果启用了 TTS,在请求大模型得到文本回复之后,将会自动调用所启用的 TTS 服务。控制台会输出 `TTS 请求: xxx` 的 INFO 级别日志。 -------------------------------------------------------------------------------- /use/update-webui.md: -------------------------------------------------------------------------------- 1 | ## 更新管理面板(重要!) 2 | 3 | 在 AstrBot 启动时,会自动检查管理面板是否需要更新,如果需要,第一条日志(黄色)会提示。 4 | 5 | 使用 `/dashboard_update` 命令可以手动更新管理面板(管理员指令)。 6 | 7 | 管理面板文件在 data/dist 目录下。如果需要手动替换,请在 https://github.com/AstrBotDevs/AstrBot/releases/ 下载 `dist.zip` 然后解压到 data 目录下。 -------------------------------------------------------------------------------- /use/websearch.md: -------------------------------------------------------------------------------- 1 | ## 内置的网页搜索功能 2 | 3 | 网页搜索功能旨在提供大模型调用 Google,Bing,搜狗等搜索引擎以获取世界最近信息的能力,一定程度上能够提高大模型的回复准确度,减少幻觉。 4 | 5 | AstrBot 内置的网页搜索功能使用了函数调用。如果您不知道函数调用是什么,请参考:[函数调用](/use/websearch) 6 | 7 | 网页搜索功能需要大模型支持函数调用功能,并且需要又大模型触发。 8 | 9 | 网页搜索的开启和关闭可以使用 `/websearch on` `/websearch off`,也可以使用统一的函数工具管理指令 `/tool ls` 查看和管理当前开启的工具(开启的工具将会作为文本描述传给大模型,以让其知道有这些工具可用) 10 | 11 | 在使用支持函数调用的大模型且开启了网页搜索功能的情况下,您可以试着说 12 | 13 | - `帮我搜索一下 xxx` 14 | - `帮我总结一下这个链接:https://soulter.top` 15 | - `查一下 xxx` 16 | - `最近 xxxx` 17 | 18 | 等等带有搜索意味的提示让大模型知道你希望让它搜索。 19 | 20 | 网页搜索使用了 21 | 22 | - Google 23 | - Bing 24 | - Sougo 25 | 26 | 三个搜索引擎,如果一个请求失败自动请求下一个。 27 | 28 | 网页搜索在能够使用 Google 的网络环境下表现最佳。 29 | 30 | 如果您的设备在国内并且有代理,可以开启代理并在 `管理面板-其他配置-HTTP代理` 填入 HTTP 代理地址以应用代理。 -------------------------------------------------------------------------------- /use/webui.md: -------------------------------------------------------------------------------- 1 | # 管理面板 2 | 3 | AstrBot 管理面板具有管理插件、查看日志、可视化配置、查看统计信息等功能。 4 | 5 | ![](../source/images/webui/image-3.png) 6 | 7 | > [!TIP] 8 | > 图中显示占用内存有 1GB 是因为此时 AstrBot 加载了一个自部署的微调大语言模型。 9 | 10 | ## 管理面板的访问 11 | 12 | 当启动 AstrBot 之后,你可以通过浏览器访问 `http://localhost:6185` 来访问管理面板。 13 | 14 | > [!TIP] 15 | > - 如果你正在云服务器上部署 AstrBot,需要将 `localhost` 替换为你的服务器 IP 地址。 16 | 17 | ## 登录 18 | 19 | 默认用户名和密码是 `astrbot` 和 `astrbot`。 20 | 21 | ## 可视化配置 22 | 23 | 在管理面板中,你可以通过可视化配置来配置 AstrBot 的插件。点击左栏 `配置` 即可进入配置页面。 24 | 25 | ![](../source/images/webui/image.png) 26 | 27 | 顶部的两个按钮可以切换`可视化编辑配置`和`代码编辑配置`。 28 | 29 | 在`可视化编辑配置`中,当修改完配置后,需要点击右下角`保存`按钮来保存配置。 30 | 31 | 在`代码编辑配置`中,你可以直接编辑配置文件,编辑完后首先点击`应用此配置`,此时配置将应用到可视化配置中,然后再点击右下角`保存`按钮来保存配置。 32 | 33 | ![](../source/images/webui/image-1.png) 34 | 35 | > [!WARNING] 36 | > 请注意,当你在`代码编辑配置`中编辑配置文件时,如果你不点击`应用此配置`,那么你的修改将不会生效。 37 | 38 | ## 插件 39 | 40 | 在管理面板中,你可以通过左栏的 `插件` 来查看已安装的插件。 41 | 42 | 点击右下角的添加按钮,可以安装插件。 43 | 44 | ![](../source/images/webui/image-2.png) 45 | 46 | ## 更新管理面板(重要!) 47 | 48 | 在 AstrBot 启动时,会自动检查管理面板是否需要更新,如果需要,第一条日志(黄色)会提示。 49 | 50 | 使用 `/dashboard_update` 命令可以手动更新管理面板(管理员指令)。 51 | 52 | 管理面板文件在 data/dist 目录下。如果需要手动替换,请在 https://github.com/AstrBotDevs/AstrBot/releases/ 下载 `dist.zip` 然后解压到 data 目录下。 53 | 54 | ## 自定义 WebUI 端口 55 | 56 | 修改 data/cmd_config.json 文件内 `dashboard` 配置中的 `port`。 -------------------------------------------------------------------------------- /use/whisper.md: -------------------------------------------------------------------------------- 1 | ## 接入 Whisper 语音转文字 2 | 3 | > [!TIP] 4 | > 如果您使用 Docker 部署 AstrBot,并且使用 Napcat,您需要在平台设置中配置路径映射,以让 AstrBot 能够正常访问到音频文件。参考 [配置](/config/astrbot-config#platform-settings) 5 | > 或者保证 AstrBot 和 Napcat 都不使用 Docker 部署。 6 | 7 | AstrBot 支持接入 Whisper 语音转文字。 8 | 9 | 有两种接入方式,一种是使用 OpenAI API 的 Whisper API 接口,另一种是在本地部署 Whisper。 10 | 11 | ### API 接入 12 | 13 | 和接入支持 OpenAI API 的大语言模型提供商一样,OpenAI API 也提供了调用 Whisper 模型的 API 接口。 14 | 15 | 配置文件类似: 16 | 17 | ```json 18 | { 19 | "id": "new_whisper(api)", 20 | "type": "openai_whisper_api", 21 | "enable": false, 22 | "api_key": "your_openai_api_key", 23 | "api_base": "your openai api base", 24 | "model": "whisper-1" 25 | }, 26 | ``` 27 | 28 | 在管理面板上配置,只需要点击此项即可可视化配置: 29 | 30 | ![](../source/images/whisper/image.png) 31 | 32 | 如果你使用 OpenAI 中转服务,请确保你的 OpenAI 的中转服务商支持 Whisper 调用。 33 | 34 | ### 本地部署 35 | 36 | 本地运行 Whisper 模型需要 `openai-whisper` 的 Python 库,请先 Pip 安装。 37 | 38 | > [!TIP] 39 | > 可以在管理面板 `控制台` 页快捷 pip 安装。 40 | > 安装此库会自动安装 Pytorch(一个深度学习库)。N 卡用户大约下载 2GB,主要是 torch 和 cuda,CPU 用户大约下载 1 GB。 41 | 42 | 除了安装 `openai-whisper` 库,还需要你的设备上安装有 `ffmpeg`。 43 | 44 | 对于 Linux,大多数包管理器都有 ffmpeg,可以直接安装。 45 | 46 | 对于 Windows,可以从 [ffmpeg 官网](https://ffmpeg.org/download.html) 下载。下载完成后建议重启电脑以使环境变量生效。 47 | 48 | ``` 49 | { 50 | "id": "new_whisper(本地加载)", 51 | "type": "openai_whisper_selfhost", 52 | "enable": true, 53 | "model": "tiny" 54 | }, 55 | ``` 56 | 57 | 在管理面板上配置,只需要点击此项的后面那项即可可视化配置: 58 | 59 | ![](../source/images/whisper/image.png) 60 | 61 | Whisper 有多种模型,默认启用最小的 `tiny` 模型,如果你的设备性能较好,可以尝试使用其他模型。 62 | 63 | 模型列表: 64 | 65 | | 模型名 | 参数量 | English-only model | Multilingual model | 需要的显存 | Relative speed | 66 | |:------:|:----------:|:------------------:|:------------------:|:-------------:|:--------------:| 67 | | tiny | 39 M | `tiny.en` | `tiny` | ~1 GB | ~10x | 68 | | base | 74 M | `base.en` | `base` | ~1 GB | ~7x | 69 | | small | 244 M | `small.en` | `small` | ~2 GB | ~4x | 70 | | medium | 769 M | `medium.en` | `medium` | ~5 GB | ~2x | 71 | | large | 1550 M | N/A | `large` | ~10 GB | 1x | 72 | | turbo | 809 M | N/A | `turbo` | ~6 GB | ~8x | -------------------------------------------------------------------------------- /what-is-astrbot.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # AstrBot 6 | 7 | ## 什么是 AstrBot? 8 | 9 | AstrBot 是一个易于上手的多平台聊天机器人及开发框架。通过它,你能够在多种消息平台上部署一个支持大语言模型(LLM)的聊天机器人。并以此实现但不限于 AI 知识库问答、角色扮演、群聊管理、LLM Agent 等功能。它有如下特性 10 | 11 | - **松耦合**:AstrBot 历经 3 次大代码重构。每一次都在向着松耦合、模块化的方向迈进。目前,AstrBot 采用了事件总线和消息事件流水线的架构设计,实现近乎完全的模块化。 12 | 13 | - **异步**:AstrBot 采用了异步编程模型,使得 AstrBot 在处理多个消息平台的消息时,能够更加高效。 14 | 15 | - **多消息平台部署**:AstrBot 默认支持接入 QQ、QQ频道、微信。通过插件,还可以接入 Telegram 等任何消息平台。 16 | 17 | - **完善的插件系统**:AstrBot 提供了完善、及其易于上手的插件系统,你可以通过插件实现自己的功能。开发一个插件,只需要几行代码。 18 | 19 | ## 它是如何实现的? 20 | 21 | 下面的拓扑图基本简述了 AstrBot 的架构。 22 | 23 | ![Architecture](source/images/what-is-astrbot/image.png) 24 | 25 | ## 说明 26 | 27 | AstrBot 受 [AGPL-v3](https://www.chinasona.org/gnu/agpl-3.0-cn.html) 开源许可证保护。如果您对 AstrBot 进行了修改并将其用于提供具有商业性质的网络服务,您必须开源所做的修改,否则将构成对许可证的违反,我们将保留对违反许可证条款的行为追究法律责任的权利。如您希望在闭源情况下进行商业使用,可联系 [community@astrbot.app](mailto:community@astrbot.app) 申请商业授权。 --------------------------------------------------------------------------------