mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-10-30 04:15:45 +08:00
doc: release 3.3
This commit is contained in:
@@ -25,9 +25,9 @@ tag:
|
||||
|
||||
以下是默认情况下的权限分类,可以根据下方的命令权限控制进行修改
|
||||
|
||||
## 用户级别命令
|
||||
> 这里只简单列举命令,具体使用方式请使用 `!cmd` 命令查看
|
||||
|
||||
> 可以使用`!help`命令来查看命令说明
|
||||
## 用户级别命令
|
||||
|
||||
任何对象可使用
|
||||
|
||||
@@ -54,6 +54,8 @@ tag:
|
||||
```
|
||||
!update 进行程序自动更新
|
||||
!default set <情景预设名称> 会话!reset时的默认情景预设
|
||||
!ollama [show|pull|del] [模型名称] 显示、拉取或删除模型的 Ollama 模型数据
|
||||
!model [show|set] [模型名称] 显示或设置当前使用的模型
|
||||
```
|
||||
|
||||
## 命令权限控制
|
||||
|
||||
@@ -38,3 +38,17 @@ category:
|
||||
意思是 plugin 命令的最低权限级别为 1,plugin.on 命令的最低权限级别为 2。 每个命令都有默认的权限级别
|
||||
|
||||
若不设置,则使用默认的级别。在`pkg/command/operators`里每个命令类有默认的权限级别
|
||||
|
||||
## 命令前缀 command-prefix
|
||||
|
||||
设置命令前缀。以数组形式设置,程序将前缀符合设置的消息视为命令(群内需要符合群响应规则)。
|
||||
|
||||
如下示例将设置命令前缀为`!`、`!`、`#`:
|
||||
|
||||
```json
|
||||
"command-prefix": [
|
||||
"!",
|
||||
"!",
|
||||
"#"
|
||||
]
|
||||
```
|
||||
@@ -88,6 +88,11 @@ category:
|
||||
"base-url": "https://api.deepseek.com",
|
||||
"args": {},
|
||||
"timeout": 120
|
||||
},
|
||||
"ollama-chat": {
|
||||
"base-url": "http://127.0.0.1:11434",
|
||||
"args": {},
|
||||
"timeout": 600
|
||||
}
|
||||
},
|
||||
```
|
||||
@@ -100,6 +105,7 @@ category:
|
||||
- `anthropic-messages`:Anthropic 请求器(Claude)
|
||||
- `moonshot-chat-completions`:Moonshot 请求器(月之暗面)
|
||||
- `deepseek-chat-completions`:Deepseek 请求器(深度求索)
|
||||
- `ollama-chat`:Ollama 请求器,不需要密钥,直接请求目标地址的 Ollama 服务
|
||||
|
||||
`base-url`:设置接口地址。
|
||||
|
||||
|
||||
+10
-17
@@ -13,33 +13,26 @@ category:
|
||||
index: false
|
||||
---
|
||||
|
||||
暂时未设计独立 API 层,本页面讲解了一些常用的功能的调用方法。
|
||||
以下提到的对象及访问方式均在前文有所提及,请先阅读插件开发教程。
|
||||
以下 API 仅针对 事件插件 可用,组件扩展形式请自行阅读源码。
|
||||
|
||||
## 消息处理
|
||||
|
||||
### 回复消息
|
||||
|
||||
切入方法:`pkg.platform.adapter.MessageSourceAdapter.reply_message`
|
||||
ctx.reply(message_chain: mirai.MessageChain)
|
||||
|
||||
由于程序中可能同时运行多个 消息平台适配器(MessageSourceAdapter),故在`query: pkg.core.entities.Query` 对象中包含了 `adapter` 对象,保存了此次请求对应的适配器,通过这个对象可以调用适配器的回复消息方法。
|
||||
回复此次事件的发起会话。
|
||||
|
||||
需要传入:
|
||||
- `message_source`本次消息的来源事件,可以从`query`对象中获取。
|
||||
- `message`回复的消息内容,YiriMirai 的 MessageChain对象
|
||||
- `quote_origin: bool`是否引用原消息
|
||||
- `message_chain`:[YiriMirai 的 MessageChain 对象](https://yiri-mirai.wybxc.cc/docs/basic/message-chain),若用户使用的不是 YiriMirai 适配器,程序也能自动转换为目标消息链
|
||||
|
||||
### 发送主动消息
|
||||
|
||||
不推荐。
|
||||
> 由于 QQ 官方 API 对主动消息的支持性很差,故若用户使用的是 QQ 官方 API,发送主动消息可能会失败
|
||||
|
||||
切入方法:`pkg.platform.adapter.MessageSourceAdapter.send_message`
|
||||
ctx.send_message(target_type: str, target_id: str, message_chain: mirai.MessageChain)
|
||||
|
||||
需要自己找到一个适配器对象,然后调用此方法。
|
||||
`ap: pkg.core.app.Application`的`platform_mgr: pkg.platform.manager.PlatformManager`对象中保存了所有适配器对象:`adapters`,从中取出一个即可调用`send_message`方法。
|
||||
发送主动消息给目标。
|
||||
|
||||
需要传入:
|
||||
|
||||
- `target_type`目标类型,可以是`group`或`person`
|
||||
- `target_id`目标id
|
||||
- `message`消息内容,YiriMirai 的 MessageChain对象
|
||||
- `target_type`:目标类型,可选值:`"person"`、`"group"`
|
||||
- `target_id`:目标 ID(QQ 号或群号)
|
||||
- `message_chain`:[YiriMirai 的 MessageChain 对象](https://yiri-mirai.wybxc.cc/docs/basic/message-chain),若用户使用的不是 YiriMirai 适配器,程序也能自动转换为目标消息链
|
||||
|
||||
@@ -103,4 +103,13 @@ index: false
|
||||
- 基类:`pkg.pipeline.msgtrun.truncator.Truncator`
|
||||
- 装饰器:`pkg.pipeline.msgtrun.truncator.truncator_class(name: str)`
|
||||
- 参考实现:`pkg.pipeline.msgtrun.truncators/`
|
||||
- 使用方式:需要在`data/config/pipeline.json`的`msg-truncate`字段中设置需要使用的截断器`method`为新增的截断器名称。
|
||||
- 使用方式:需要在`data/config/pipeline.json`的`msg-truncate`字段中设置需要使用的截断器`method`为新增的截断器名称。
|
||||
|
||||
### Chat 请求运行器
|
||||
|
||||
新增一个聊天消息运行器,默认的是 local-agent,提供了基本的 Prompt 组合、Agent 编排、多轮请求等功能。如果需要接入知识库或者本地 RAG,请在这里实现。
|
||||
|
||||
- 基类:`pkg.provider.runner.RequesterRunner`
|
||||
- 装饰器:`pkg.provider.runner.runner_class(name: str)`
|
||||
- 参考实现:`pkg.provider.runners/`
|
||||
- 使用方式:需要在`data/config/provider.json`的`runner`字段中设置需要使用的运行器`runner`为新增的运行器名称。
|
||||
Reference in New Issue
Block a user