4.6.0 (#71)
* feat: unified webhook (#70) * feat: add qqo,wxoa,wxbot & wecom * feat: add wecom images & line webhook docs update ,en docs update * docs: wecombot docs update * feat: add slack * feat: add images * perf: docs * update settings.md * docs: complete --------- Co-authored-by: WangCham <[email protected]> Co-authored-by: Dong_master <[email protected]> Co-authored-by: wangcham <[email protected]> * feat: update docs --------- Co-authored-by: WangCham <[email protected]> Co-authored-by: Dong_master <[email protected]> Co-authored-by: wangcham <[email protected]>
@@ -238,6 +238,13 @@ export default defineConfig({
|
||||
{
|
||||
text: "实践",
|
||||
items: [
|
||||
{
|
||||
text: "将 LangBot 用于生产环境",
|
||||
collapsed: true,
|
||||
items: [
|
||||
{ text: "配置 HTTP 反向代理或通过网关访问 LangBot", link: "/zh/workshop/production/proxy-and-ssl" },
|
||||
]
|
||||
},
|
||||
{
|
||||
text: "如何实现一个消息平台适配器?",
|
||||
link: "/zh/workshop/impl-platform-adapter",
|
||||
@@ -511,6 +518,13 @@ export default defineConfig({
|
||||
{
|
||||
text: "Workshops",
|
||||
items: [
|
||||
{
|
||||
text: "Using LangBot in Production Environment",
|
||||
collapsed: true,
|
||||
items: [
|
||||
{ text: "Configuring HTTP Reverse Proxy or Accessing LangBot via Gateway", link: "/en/workshop/production/proxy-and-ssl" },
|
||||
],
|
||||
},
|
||||
{
|
||||
text: "How to Implement a Message Platform Adapter?",
|
||||
link: "/en/workshop/impl-platform-adapter",
|
||||
|
||||
|
After Width: | Height: | Size: 35 KiB |
|
Before Width: | Height: | Size: 135 KiB After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 72 KiB |
|
Before Width: | Height: | Size: 126 KiB After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 192 KiB After Width: | Height: | Size: 38 KiB |
|
After Width: | Height: | Size: 38 KiB |
|
After Width: | Height: | Size: 38 KiB |
|
Before Width: | Height: | Size: 152 KiB After Width: | Height: | Size: 96 KiB |
|
After Width: | Height: | Size: 38 KiB |
|
Before Width: | Height: | Size: 169 KiB After Width: | Height: | Size: 39 KiB |
@@ -1,29 +1,34 @@
|
||||
# Using Knowledge Base
|
||||
# Using the Knowledge Base
|
||||
|
||||
LangBot natively supports RAG (Retrieval-Augmented Generation), you can create a knowledge base and bind it to a pipeline, and the pipeline will answer questions based on the content in the knowledge base.
|
||||
LangBot natively supports RAG (Retrieval-Augmented Generation). You can create a built-in knowledge base and bind it to a pipeline, allowing the pipeline to answer questions based on the contents of the knowledge base. LangBot also supports connecting to external knowledge retrieval services (e.g., Dify, RAGFlow).
|
||||
|
||||
## Build a Built-in Knowledge Base
|
||||
|
||||
:::info
|
||||
- You need to configure the embedding model before creating a knowledge base, please read [Configure Models](/en/deploy/models/readme).
|
||||
- Creating and using a built-in knowledge base requires configuring an embedding model first. Please read [Configure Models](/en/deploy/models/readme).
|
||||
:::
|
||||
|
||||
## Build Knowledge Base
|
||||
|
||||
In the knowledge base page, click the `Create Knowledge Base` button, fill in the knowledge base name, select the configured embedding model, and click the `Create` button.
|
||||
On the knowledge base page, click the `Create Knowledge Base` button, fill in the name, select an already configured embedding model, then click `Create`.
|
||||
After creation, go to the "Documents" tab of your knowledge base and upload documents. LangBot will automatically parse and index these in the background.
|
||||
|
||||
<img width="400px" src="/assets/image/zh/deploy/knowledge/upload_docs.png" alt="create_kb" />
|
||||
|
||||
## Use Knowledge Base
|
||||
## Connect External Knowledge Base
|
||||
|
||||
Please go to the pipeline configuration, in the "AI" page, select `Local Agent` as the runner, and select the knowledge base you just created below.
|
||||
On the knowledge base page, switch to the "External Knowledge Base" tab and add an external retriever. In the dialog, select the knowledge retriever plugin to use (please install the related plugin in Plugin Management first). Supported retrievers can be found in the [Plugin Marketplace](https://space.langbot.app/market?category=KnowledgeRetriever).
|
||||
|
||||
## Use the Knowledge Base
|
||||
|
||||
Go to your pipeline configuration, under the "AI" tab, choose `Local Agent` as the runner, then select the knowledge base you just created.
|
||||
|
||||
<img width="400px" src="/assets/image/zh/deploy/knowledge/use_local_agent.png" alt="use_kb" />
|
||||
|
||||
<img width="400px" src="/assets/image/zh/deploy/knowledge/use_kb.png" alt="use_kb" />
|
||||
|
||||
:::info
|
||||
Only when the runner is `Local Agent`, can you use the LangBot native knowledge base, if you want to use the knowledge base with other runners, please refer to the documentation of the corresponding product.
|
||||
LangBot's built-in knowledge base can be used only when the runner is set to `Local Agent`. For other runners, refer to their documentation.
|
||||
:::
|
||||
|
||||
Now you can use the knowledge base to chat in the `Chat Debug` or the robot bound to the pipeline:
|
||||
Now you can use the knowledge base in `Chat Debug`, or through the bot linked to this pipeline:
|
||||
|
||||
<img width="400px" src="/assets/image/zh/deploy/knowledge/use_kb_in_chat.png" alt="use_kb_in_chat" />
|
||||
@@ -71,8 +71,32 @@ After creation, you will obtain the following important information, please reco
|
||||
* Click the icon to copy
|
||||

|
||||
|
||||
## Connecting to LangBot
|
||||
|
||||
Next, open the LangBot configuration page:
|
||||
|
||||
1. Click "Bots", then click "Add"
|
||||

|
||||
2. Select "LINE" in "Platform/Adapter Selection"
|
||||

|
||||
|
||||
3. Fill in the configuration information:
|
||||
- Channel Secret: The Channel secret you obtained earlier
|
||||
- Channel Access Token: The Channel access token you obtained earlier
|
||||

|
||||
|
||||
4. Click "Save" to complete the configuration
|
||||

|
||||
|
||||
## Configure Webhook
|
||||
|
||||
::: info
|
||||
We recommend that you first refer to [Configure HTTP Reverse Proxy](/en/workshop/production/proxy-and-ssl) to configure the LangBot callback address.
|
||||
:::
|
||||
|
||||
* Get the Webhook callback URL from the LangBot configuration page
|
||||

|
||||
|
||||
* Click console or directly visit [Console](https://developers.line.biz/console/)
|
||||

|
||||
* Select the Provider you created and click Message API
|
||||
@@ -90,22 +114,6 @@ After creation, you will obtain the following important information, please reco
|
||||
5. Click the "Verify" button to test if the connection is successful
|
||||

|
||||
|
||||
## Connecting to LangBot
|
||||
|
||||
Next, open the LangBot configuration page:
|
||||
|
||||
1. Click "Bots", then click "Add"
|
||||

|
||||
2. Select "LINE" in "Platform/Adapter Selection"
|
||||

|
||||
|
||||
3. Fill in the configuration information:
|
||||
- Channel Secret: The Channel secret you obtained earlier
|
||||
- Channel Access Token: The Channel access token you obtained earlier
|
||||

|
||||
|
||||
4. Click "Save" to complete the configuration
|
||||

|
||||
|
||||
## Feature Configuration
|
||||
|
||||
|
||||
@@ -2,6 +2,12 @@
|
||||
|
||||
This article only provides the deployment of test bots. For the official launch of bots, please follow the [release process](https://q.qq.com/qqbot/#/home).
|
||||
|
||||
:::warning
|
||||
QQ Official has issued an announcement prohibiting unauthorized access to AIGC features. Please use with caution.
|
||||
:::
|
||||
|
||||
|
||||
|
||||
## Register QQ Bot (Test Bot)
|
||||
|
||||
### Configure Basic Bot Information
|
||||
@@ -34,53 +40,14 @@ Next, open the LangBot configuration page
|
||||
|
||||
Click on Bots, then click Add
|
||||
|
||||
Select `OneBot v11` for `Platform/Adapter Selection`
|
||||
Select `QQ Official API` for `Platform/Adapter Selection`
|
||||
|
||||

|
||||
|
||||
|
||||
## Configure Callback Address
|
||||
|
||||
Since QQ official bots require the callback address to be an https request, but LangBot only provides http, you need to configure a reverse proxy yourself.
|
||||
|
||||
This article recommends using [Caddy](https://caddy2.dengxiaolong.com/docs/) for reverse proxy, with the process as follows.
|
||||
|
||||
### Caddy Operation Process
|
||||
|
||||
#### Install Caddy
|
||||
|
||||
Go to the [Caddy Installation Documentation](https://caddy2.dengxiaolong.com/docs/install). Choose the installation steps for your operating system and install.
|
||||
|
||||
#### Fill in Caddyfile
|
||||
|
||||
This article assumes that LangBot is deployed on an Ubuntu system, where the default location of Caddyfile is `/etc/caddy/Caddyfile`.
|
||||
Use vim or nano to edit Caddyfile, and fill in the Caddyfile as:
|
||||
```json
|
||||
your_domain_name {
|
||||
reverse_proxy 127.0.0.1:2284
|
||||
}
|
||||
```
|
||||
For example, if you have a domain testlb.com that resolves to your machine, and you have port **443** open, fill in:
|
||||
```json
|
||||
testlb.com {
|
||||
reverse_proxy 127.0.0.1:2284
|
||||
}
|
||||
```
|
||||
|
||||
Save and exit the file.
|
||||
|
||||
**Note, the Caddyfile format is very strict, please fill it in correctly. If you encounter problems, please refer to the Caddy documentation or ask AI.**
|
||||
|
||||
#### Start Caddy
|
||||
Enter the command
|
||||
```bash
|
||||
sudo systemctl start caddy
|
||||
```
|
||||
|
||||
After successful startup, check the Caddy status with:
|
||||
```bash
|
||||
sudo systemctl status caddy
|
||||
```
|
||||
LangBot must be deployed on a server with a public IP address, and HTTPS must be successfully enabled. Please follow the documentation [Configure HTTP Reverse Proxy and SSL](/en/workshop/production/proxy-and-ssl) for configuration.
|
||||
|
||||
|
||||
#### Subsequent Configuration
|
||||
@@ -98,9 +65,15 @@ Here are some possible issues:
|
||||
|
||||
First **start LangBot**.
|
||||
|
||||
Click on `Callback Configuration` in the bot management portal, check all events under `Add Event`. In the request address, enter the domain set in Caddyfile, with the suffix `/callback/command`.
|
||||
Click on `Callback Configuration` in the bot management portal, check all events under `Add Event`.
|
||||
|
||||
For example, if the domain is `testlb.com`, then enter `testlb.com/callback/command` in the request address, and click to confirm the configuration. If the callback address is saved successfully, it means the deployment is successful. If you see `Verification Failed`, please carefully check if the above configuration items are filled in correctly.
|
||||
Go to the LangBot configuration page, enable and select the corresponding QQ bot, copy the Webhook callback address from the corresponding bot configuration page, replace the IP address and port with the domain name configured in Caddy, and enter it in the request address.
|
||||
|
||||
As shown in the image:
|
||||

|
||||
|
||||
|
||||
For example, if the domain is `testlb.com`, then enter `testlb.com/bots/xxxxxx-xxxxxx` in the request address, and click to confirm the configuration. If the callback address is saved successfully, it means the deployment is successful. If you see `Verification Failed`, please carefully check if the above configuration items are filled in correctly.
|
||||
|
||||
## Publication Method
|
||||
|
||||
|
||||
@@ -37,14 +37,14 @@ After completing all the above operations, open the LangBot Webui configuration
|
||||
|
||||
## Start Bot
|
||||
|
||||
After filling in the Slack configuration items, **start LangBot**.
|
||||
Then in the `Request URL` of the Event Subscriptions you just configured, fill in the deployment address of your LangBot.
|
||||
|
||||
::: info
|
||||
Since Slack officially requires https, you can refer to the [Caddy configuration part in the QQ official bot deployment process](/en/deploy/platforms/qq/official_webhook.md#caddy-operation-process), note that the port uses the port configured in the Slack adapter.
|
||||
|
||||
Since Slack officially requires https, please configure reverse proxy first according to the documentation [Configure HTTP Reverse Proxy and SSL](/en/workshop/production/proxy-and-ssl).
|
||||
:::
|
||||
|
||||
After filling in the Slack configuration items, **start LangBot**.
|
||||
Enable and open the Slack bot configuration page on the LangBot homepage, copy the WebHook URL from it, then in the `Request URL` of the Event Subscriptions you just configured, fill in the WebHook URL.
|
||||
|
||||
|
||||
After filling in all the above configuration items, click save link. If it shows a green **Verified**, it means the deployment is successful.
|
||||
Otherwise, check if the above configuration items are filled in correctly.
|
||||
|
||||
|
||||
@@ -50,7 +50,13 @@ Click `Enterprise Trusted IP` at the bottom and add the server where LangBot is
|
||||
|
||||
Click `Receive Messages`, `Set API Reception`, and start filling in the server message reception configuration.
|
||||
|
||||
Fill in the URL as `http://your_ip_address:2290/callback/command`, where your IP address is the address of the server where LangBot is deployed.
|
||||
On the LangBot homepage, enable and select the corresponding bot, click to enter the configuration page, copy the Webhook callback address, and fill it into the URL.
|
||||
|
||||
::: info
|
||||
We recommend that you first refer to [Configure HTTP Reverse Proxy](/en/workshop/production/proxy-and-ssl) to configure the LangBot callback address.
|
||||
:::
|
||||
|
||||

|
||||
|
||||
Click to randomly generate the Token and EncodingAESKey, and record them
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ As shown:
|
||||
|
||||

|
||||
|
||||
Click `Create Bot`, scroll to the bottom of the page, click `API模式创建`, and enter the page:
|
||||
Click `Create Bot`, scroll to the bottom of the page, click `Create via API Mode`, and enter the page:
|
||||
|
||||

|
||||
|
||||
@@ -29,7 +29,15 @@ Among them, the token is Token, the Encoding-AESKey is EncodingAESKey, and the B
|
||||
|
||||

|
||||
|
||||
Return to the WeCom robot configuration page, and fill in the robot callback URL (accepts HTTP) in `URL`, for example: **http://xxx.xxx.xx.xx:2291/callback/command**. If the creation is successful, it will jump to the details page. If the message `Request URL Failed` appears, please double-check whether the above steps have been completed one by one.
|
||||
On the LangBot homepage, enable and select the corresponding bot, click to enter the configuration page, copy the Webhook callback address
|
||||
|
||||
::: info
|
||||
We recommend that you first refer to [Configure HTTP Reverse Proxy](/en/workshop/production/proxy-and-ssl) to configure the LangBot callback address.
|
||||
:::
|
||||
|
||||

|
||||
|
||||
Return to the WeCom robot configuration page and fill the copied webhook address into `URL Callback`. If the creation is successful, it will jump to the details page. If the message `Request URL Failed` appears, please double-check whether the above steps have been completed one by one.
|
||||
|
||||
Details page after successful creation:
|
||||

|
||||
|
||||
@@ -32,11 +32,9 @@ Click `Settings and Development`, `Development Interface Management`, and you'll
|
||||
|
||||
Record the `Developer ID (AppID)`, `Developer Password (AppSecret)`, and add the server where LangBot is deployed to the `IP Whitelist`.
|
||||
|
||||
### Set Up Reverse Proxy
|
||||
### Set Up Reverse Proxy for LangBot
|
||||
|
||||
Since WeChat Official Accounts only support http (port 80) and https (port 443), this article assumes that port 80 is already occupied and uses port 443 to reverse proxy to LangBot.
|
||||
|
||||
The specific reverse proxy configuration tutorial is the same as the [QQ Official Bot Reverse Proxy Configuration](/en/deploy/platforms/qq/official_webhook.md#caddy-operation-process), except that `reverse_proxy 127.0.0.1:2284` is changed to `reverse_proxy 127.0.0.1:2287`.
|
||||
Since WeChat Official Accounts only support http (port 80) and https (port 443), please follow the documentation [Configure HTTP Reverse Proxy and SSL](/en/workshop/production/proxy-and-ssl) for configuration.
|
||||
|
||||
### Save Callback Address
|
||||
|
||||
@@ -50,6 +48,4 @@ In the configuration items, the `Mode` option is the selected integration mode,
|
||||
|
||||
The `LoadingMessage` option is the loading message, which can be changed to other content, and is only valid when the mode is `passive`. Set `enable` to `true`.
|
||||
|
||||
After filling in successfully, **start LangBot**.
|
||||
|
||||
Fill in the URL as `https://your_domain_name/callback/command`, where `your_domain_name` is the domain name filled in Caddy. Click Save. If it can be saved successfully, it means the deployment is successful. If you see **System error, please try again later**, please recheck whether the above configuration content is filled in correctly.
|
||||
After filling in successfully, on the LangBot homepage, enable and select the corresponding bot, click to enter the configuration page, copy the Webhook callback address, return to the WeChat Official Account bot configuration page, and fill it into `URL`. For example, if the URL is filled as `https://your_domain_name/bots/xxxxx`, where `your_domain_name` is the domain name filled in Caddy. Click Save. If it can be saved successfully, it means the deployment is successful. If you see **System error, please try again later**, please recheck whether the above configuration content is filled in correctly.
|
||||
|
||||
@@ -16,6 +16,10 @@ admins: []
|
||||
# API port
|
||||
api:
|
||||
port: 5300
|
||||
# LangBot centrally manages all bot addresses that require Webhook listening
|
||||
# This is the Webhook address prefix displayed on the bot page that requires Webhook connection
|
||||
# You can modify it according to your network environment
|
||||
webhook_prefix: 'http://127.0.0.1:5300'
|
||||
|
||||
# Command configuration
|
||||
command:
|
||||
|
||||
@@ -56,6 +56,12 @@ LangBot is an open-source LLM native instant messaging robot development platfor
|
||||
| RAG | ✅ | Using Chroma as vector database |
|
||||
| MCP | ✅ | Support Stdio and HTTP protocol |
|
||||
|
||||
## System Extensibility
|
||||
|
||||
- HTTP Service API: Supports accessing various entities of LangBot through HTTP API interfaces with API key authentication.
|
||||
- Outgoing Webhook: Supports sending internal events of LangBot to external systems through Webhook.
|
||||
- Production-grade plugin system: A production-grade plugin system based on cross-process communication technology and asynchronous technology, supporting various component extensions.
|
||||
|
||||
## Case Screenshots
|
||||
|
||||

|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
# Configure HTTP Reverse Proxy or Access LangBot Through Gateway
|
||||
|
||||
LangBot does not have built-in SSL support for HTTPS services. If you need to resolve a domain name to a LangBot instance, or need to use HTTPS to access LangBot WebUI and webhook addresses for various bots, please refer to this document to deploy NGINX or Caddy to implement HTTP reverse proxy.
|
||||
|
||||
You need to deploy LangBot on a host with a public IP address, purchase a domain name, and resolve the domain name to the host's public IP.
|
||||
|
||||
::: warning
|
||||
If you need to use bots that require Webhook callback addresses such as QQ Official Bot, WeChat Official Account, WeCom, Slack, LINE, etc., you must configure HTTP reverse proxy according to this document.
|
||||
:::
|
||||
|
||||
## Caddy
|
||||
|
||||
Caddy is a modern HTTP server that supports automatic HTTPS certificate application and renewal, reverse proxy, and automatic DNS resolution configuration.
|
||||
|
||||
[Caddy Installation Documentation](https://caddy2.dengxiaolong.com/docs/install). Select the installation steps corresponding to your operating system and proceed with the installation.
|
||||
|
||||
### Configure Caddyfile
|
||||
|
||||
This document assumes using the Ubuntu system to deploy LangBot. In the system, the default location of Caddyfile is `/etc/caddy/Caddyfile`.
|
||||
Use vim or nano to edit Caddyfile, and fill in the Caddyfile as follows:
|
||||
|
||||
```json
|
||||
your.domain.com {
|
||||
reverse_proxy 127.0.0.1:5300
|
||||
}
|
||||
```
|
||||
|
||||
::: info
|
||||
If your Caddy and LangBot are deployed using containers, please check [Container Network Configuration Details](/en/workshop/network-details)
|
||||
:::
|
||||
|
||||
Now, you can access LangBot WebUI through your browser at `https://your.domain.com`.
|
||||
|
||||
### Set Bot Callback Address Prefix
|
||||
|
||||
If you need to use bots that require Webhook callback addresses such as QQ Official Bot, WeChat Official Account, WeCom, Slack, LINE, etc., please set `api.webhook_prefix` in the data/config.yaml file to your domain name. For example: `https://your.domain.com`.
|
||||
|
||||
After that, you will see the correctly displayed callback address on the bot management page.
|
||||
|
||||
## NGINX
|
||||
|
||||
NGINX is also a commonly used HTTP server and reverse proxy tool that can be used to implement HTTPS access to LangBot.
|
||||
|
||||
### Install NGINX
|
||||
|
||||
On Ubuntu, you can install NGINX with the following commands:
|
||||
|
||||
```bash
|
||||
sudo apt update
|
||||
sudo apt install nginx
|
||||
```
|
||||
|
||||
### Prepare SSL Certificate
|
||||
|
||||
You can use [Let's Encrypt](https://letsencrypt.org/) to apply for a free SSL certificate. It is recommended to use the [Certbot](https://certbot.eff.org/) tool to obtain a certificate:
|
||||
|
||||
```bash
|
||||
sudo apt install certbot python3-certbot-nginx
|
||||
sudo certbot --nginx
|
||||
```
|
||||
|
||||
Follow the prompts to enter your domain name, and certificate application and NGINX configuration will be completed automatically. If you need to configure manually, you can refer to the following content.
|
||||
|
||||
### Configure NGINX Reverse Proxy
|
||||
|
||||
Edit the NGINX configuration file `/etc/nginx/sites-available/langbot` (you can use vim or nano editor):
|
||||
|
||||
```nginx
|
||||
server {
|
||||
listen 80;
|
||||
server_name your.domain.com;
|
||||
# Redirect HTTP traffic to HTTPS
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
server_name your.domain.com;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/your.domain.com/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/your.domain.com/privkey.pem;
|
||||
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
ssl_ciphers HIGH:!aNULL:!MD5;
|
||||
|
||||
# Reverse proxy to LangBot instance
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:5300;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Replace `your.domain.com` with your actual domain name.
|
||||
|
||||
Enable this configuration and restart NGINX:
|
||||
|
||||
```bash
|
||||
sudo ln -s /etc/nginx/sites-available/langbot /etc/nginx/sites-enabled/langbot
|
||||
sudo nginx -t
|
||||
sudo systemctl reload nginx
|
||||
```
|
||||
|
||||
### Set Bot Callback Address Prefix
|
||||
|
||||
Similarly, set `api.webhook_prefix` to `https://your.domain.com` in the `data/config.yaml` configuration file, so that the bot Webhook callback address will be correct.
|
||||
|
||||
After completing the above configuration, you can securely access LangBot WebUI and bot Webhook services through `https://your.domain.com`.
|
||||
@@ -1,18 +1,22 @@
|
||||
# 使用知识库 (Knowledge Base)
|
||||
|
||||
LangBot 原生支持 RAG(Retrieval-Augmented Generation,即检索增强生成),您可以创建知识库,并将其与流水线绑定,流水线将根据知识库中的内容回答问题。
|
||||
LangBot 原生支持 RAG(Retrieval-Augmented Generation,即检索增强生成),您可以创建内置知识库,并将其与流水线绑定,流水线将根据知识库中的内容回答问题。同时,我们支持接入外部服务(Dify、RAGFLow等)提供的知识检索服务。
|
||||
|
||||
## 构建内置知识库
|
||||
|
||||
:::info
|
||||
- 知识库的创建和使用需要先配置嵌入模型,请先阅读[配置模型](/zh/deploy/models/readme)。
|
||||
- 内置知识库的创建和使用需要先配置嵌入模型,请先阅读[配置模型](/zh/deploy/models/readme)。
|
||||
:::
|
||||
|
||||
## 构建知识库
|
||||
|
||||
在知识库页面,点击`创建知识库`按钮,填写知识库名称,选择已配置好的嵌入模型,然后点击`创建`按钮。
|
||||
之后请到知识库的“文档”页面,上传文档,LangBot 将会在后台开始解析和索引。
|
||||
|
||||
<img width="400px" src="/assets/image/zh/deploy/knowledge/upload_docs.png" alt="create_kb" />
|
||||
|
||||
## 接入外部知识库
|
||||
|
||||
请在知识库页面,切换到“外部知识库”标签页,添加外部知识库。在对话框中可以选择需要使用的外部知识库检索器,您需要先在插件管理中安装对应的插件。目前支持的知识检索器可以在[插件市场](https://space.langbot.app/market?category=KnowledgeRetriever)中查看。
|
||||
|
||||
## 使用知识库
|
||||
|
||||
请到流水线配置中,“AI 能力”页,选择`内置 Agent`作为运行器,并在下方选择您刚刚创建的知识库。
|
||||
|
||||
@@ -78,12 +78,33 @@
|
||||
|
||||
|
||||
|
||||
## 对接 LangBot
|
||||
|
||||
接下来打开 LangBot 配置页面:
|
||||
|
||||
1. 点击 "机器人",然后点击 "添加"
|
||||

|
||||
2. 在 "平台/适配器选择" 中选择 "LINE"
|
||||

|
||||
|
||||
3. 填写配置信息:
|
||||
- Channel Secret:您之前获取的 Channel Secret
|
||||
- Channel Access Token:您之前获取的 Channel Access Token
|
||||

|
||||
|
||||
4. 点击 "保存" 完成配置
|
||||

|
||||
|
||||
|
||||
## 配置Webhook
|
||||
|
||||
::: info
|
||||
推荐您先参照[配置 HTTP 反向代理](/zh/workshop/production/proxy-and-ssl)来配置 LangBot 回调地址。
|
||||
:::
|
||||
|
||||
* 从 LangBot 配置页面获取 Webhook 回调地址
|
||||

|
||||
|
||||
* 点击控制台或者直接访问 [控制台](https://developers.line.biz/console/)
|
||||

|
||||
* 选择你创建的 Provider 并点击 Message API
|
||||
@@ -102,23 +123,6 @@
|
||||

|
||||
|
||||
|
||||
## 对接 LangBot
|
||||
|
||||
接下来打开 LangBot 配置页面:
|
||||
|
||||
1. 点击 "机器人",然后点击 "添加"
|
||||

|
||||
2. 在 "平台/适配器选择" 中选择 "LINE"
|
||||

|
||||
|
||||
3. 填写配置信息:
|
||||
- Channel Secret:您之前获取的 Channel Secret
|
||||
- Channel Access Token:您之前获取的 Channel Access Token
|
||||

|
||||
|
||||
4. 点击 "保存" 完成配置
|
||||

|
||||
|
||||
|
||||
## 功能配置
|
||||
|
||||
|
||||
@@ -2,6 +2,12 @@
|
||||
|
||||
本文章只提供测试版机器人的发布,具体机器人上线请按照 [发布流程](https://q.qq.com/qqbot/#/home) 进行部署。
|
||||
|
||||
:::warning
|
||||
目前 QQ 官方发布公告,禁止违规接入 AIGC 功能,请慎重使用。
|
||||
:::
|
||||
|
||||
|
||||
|
||||
## 注册 QQ 机器人(测试机器人)
|
||||
|
||||
### 配置机器人基本信息
|
||||
@@ -34,53 +40,14 @@
|
||||
|
||||
点击机器人,点击添加
|
||||
|
||||
`平台/适配器选择`为`OneBot v11`
|
||||
`平台/适配器选择`为`QQ官方API`
|
||||
|
||||

|
||||
|
||||
|
||||
## 配置回调地址
|
||||
|
||||
由于QQ官方机器人必须要求回调地址是 https 请求,但 LangBot 仅提供 http 方式,所以需要自行配置反向代理。
|
||||
|
||||
本文建议使用 [Caddy](https://caddy2.dengxiaolong.com/docs/) 反向代理,操作流程如下文。
|
||||
|
||||
### 操作caddy流程
|
||||
|
||||
#### 安装caddy
|
||||
|
||||
进入[Caddy安装文档](https://caddy2.dengxiaolong.com/docs/install)。选择对应自己操作系统的安装步骤,进行安装。
|
||||
|
||||
#### 填写Caddyfile
|
||||
|
||||
本文假设使用 ubuntu 系统部署 LangBot ,那么在系统中,Caddyfile 的默认位置为 `/etc/caddy/Caddyfile`。
|
||||
使用 vim 或 nano 编辑 Caddyfile ,Caddyfile文件填写为:
|
||||
```json
|
||||
your_domain_name {
|
||||
reverse_proxy 127.0.0.1:2284
|
||||
}
|
||||
```
|
||||
例如,如果你有域名 testlb.com,并且解析地址为本机,同时开启**443**端口,那么填写为:
|
||||
```json
|
||||
testlb.com {
|
||||
reverse_proxy 127.0.0.1:2284
|
||||
}
|
||||
```
|
||||
|
||||
保存并且退出文件。
|
||||
|
||||
**注,Caddyfile文件的填写要求非常严苛,请按照正确的格式填写,如果遇到问题请自行查询Caddy文档或者询问AI。**
|
||||
|
||||
#### 启动caddy
|
||||
输入命令
|
||||
```bash
|
||||
sudo systemctl start caddy
|
||||
```
|
||||
|
||||
成功启动后,检查 Caddy 状态命令:
|
||||
```bash
|
||||
sudo systemctl status caddy
|
||||
```
|
||||
要求 LangBot 部署在具有公网 IP 的服务器上,并已成功启用 HTTPS。请根据文档[配置 HTTP 反向代理和 SSL](/zh/workshop/production/proxy-and-ssl) 操作。
|
||||
|
||||
|
||||
#### 后续配置
|
||||
@@ -98,9 +65,15 @@ sudo systemctl status caddy
|
||||
|
||||
首先 **启动 LangBot** 。
|
||||
|
||||
点击 机器人管理端网页中的 `回调配置`,勾选下面 `添加事件` 中的所有事件。 在请求地址中填写 Caddyfile 中设置的域名,后缀为`/callback/command`。
|
||||
点击 机器人管理端网页中的 `回调配置`,勾选下面 `添加事件` 中的所有事件。
|
||||
|
||||
比如域名为 `testlb.com`,那么请求地址中填写 `testlb.com/callback/command` ,点击确定配置。如果回调地址保存成功,那么意味着部署成功。若出现 `校验失败` 字样,请认真检查上述配置项是否填写正确。
|
||||
进入 LangBot 配置页面,启用并且选择对应的QQ机器人,粘贴对应机器人配置页面中的 Webhook 回调地址,将其中的 IP 地址和端口改成之前 Caddy 配置的域名,在请求地址中填入。
|
||||
|
||||
如图:
|
||||

|
||||
|
||||
|
||||
比如域名为 `testlb.com`,那么请求地址中填写 `testlb.com/bots/xxxxxx-xxxxxx` ,点击确定配置。如果回调地址保存成功,那么意味着部署成功。若出现 `校验失败` 字样,请认真检查上述配置项是否填写正确。
|
||||
|
||||
## 发布方式
|
||||
|
||||
|
||||
@@ -38,14 +38,14 @@
|
||||
|
||||
## 启动机器人
|
||||
|
||||
Slack 配置项在填写完成后,**启动 LangBot**。
|
||||
然后在刚才Event Subscriptions的 `Request URL`中,填写入你的 LangBot 的部署地址。
|
||||
|
||||
::: info
|
||||
由于 Slack 官方要求使用 https,可以参考[QQ官方机器人部署流程中的Caddy配置部分](/zh/deploy/platforms/qq/official_webhook.md#操作caddy流程),注意端口使用 Slack 适配器配置的端口。
|
||||
|
||||
由于 Slack 官方要求使用 https,请根据文档[配置 HTTP 反向代理和 SSL](/zh/workshop/production/proxy-and-ssl) 先配置好反向代理。
|
||||
:::
|
||||
|
||||
Slack 配置项在填写完成后,**启动 LangBot**。
|
||||
启用并打开 LangBot 主页中的 Slack 机器人配置页面,复制其中的 WebHook URL,在刚才Event Subscriptions的 `Request URL`中,填写入 WebHook URL。
|
||||
|
||||
|
||||
上述配置项都填写完成后,点击保存链接,若标识为绿色的**Verified**,那么就说明部署成功。
|
||||
否则查看上述配置项是否填写正确。
|
||||
|
||||
|
||||
@@ -50,7 +50,13 @@
|
||||
|
||||
点击` 接收消息 `,` 设置API接收 `,开始填写接收服务器消息配置。
|
||||
|
||||
URL填写为` http://your_ip_address:2290/callback/command `,你的IP地址就是部署LangBot的服务器的地址。
|
||||
在 LangBot 主页中,启用并选择对应的机器人,点击进入配置页面,复制其中的 Webhook 回调地址,填写到 URL 中。
|
||||
|
||||
::: info
|
||||
推荐您先参照[配置 HTTP 反向代理](/zh/workshop/production/proxy-and-ssl)来配置 LangBot 回调地址。
|
||||
:::
|
||||
|
||||

|
||||
|
||||
Token 和 EncodingAESKey 点击随机获取,并记录下来
|
||||
|
||||
|
||||
@@ -29,7 +29,15 @@
|
||||
|
||||

|
||||
|
||||
返回企业微信机器人配置页面,在`URL回调`中填写入机器人回调地址(接受http),例:**http://xxx.xxx.xx.xx:2291/callback/command** 。若创建成功,则会跳转至详情页面,若出现`请求URL失败`字样,请再三检查上述操作是否一一完成。
|
||||
在 LangBot 主页中,启用并选择对应的机器人,点击进入配置页面,复制其中的 Webhook 回调地址
|
||||
|
||||
::: info
|
||||
推荐您先参照[配置 HTTP 反向代理](/zh/workshop/production/proxy-and-ssl)来配置 LangBot 回调地址。
|
||||
:::
|
||||
|
||||

|
||||
|
||||
返回企业微信机器人配置页面将复制的webhook地址填写到`URL回调`中。若创建成功,则会跳转至详情页面,若出现`请求URL失败`字样,请再三检查上述操作是否一一完成。
|
||||
|
||||
创建成功之后的详情页:
|
||||

|
||||
|
||||
@@ -32,11 +32,9 @@
|
||||
|
||||
记录下来`开发者ID(AppID)`,`开发者密码(AppSecret)`,并将部署 LangBot 的服务器添加入`IP白名单`。
|
||||
|
||||
### 设置反向代理
|
||||
### 为 LangBot 设置反向代理
|
||||
|
||||
由于微信公众号的只支持http(80端口),https(443端口),所以本文假设80端口已被占用,使用443端口反向代理至 LangBot 。
|
||||
|
||||
具体的反向代理配置教程与[QQ官方机器人反向代理配置](/zh/deploy/platforms/qq/official_webhook.md#操作caddy流程)相同,只是将`reverse_proxy 127.0.0.1:2284`改为`reverse_proxy 127.0.0.1:2287`。
|
||||
由于微信公众号的只支持http(80端口),https(443端口),请根据文档[配置 HTTP 反向代理和 SSL](/zh/workshop/production/proxy-and-ssl) 操作。
|
||||
|
||||
### 保存回调地址
|
||||
|
||||
@@ -50,7 +48,5 @@
|
||||
|
||||
`LoadingMessage`选项为加载信息,可以更改为其他内容,仅在模式为`passive`下有效。将 `enable` 设置为 `true` 。
|
||||
|
||||
填写成功后,**启动 LangBot** 。
|
||||
|
||||
将 URL 填写为`https://your_domain_name/callback/command`,其中的 `your_domain_name` 就是 Caddy 中填写的域名。点击保存。如果可以保存成功,那么意味着部署成功。如果出现**系统发生错误,请稍后重试**,那么请重新检查以上配置内容是否填写正确。
|
||||
填写成功后,在 LangBot 主页中,启用并选择对应的机器人,点击进入配置页面,复制其中的 Webhook 回调地址,返回微信公众号机器人配置页面,填写到`URL`。比如 URL 填写为`https://your_domain_name/bots/xxxxx`,其中的 `your_domain_name` 就是 Caddy 中填写的域名。点击保存。如果可以保存成功,那么意味着部署成功。如果出现**系统发生错误,请稍后重试**,那么请重新检查以上配置内容是否填写正确。
|
||||
|
||||
|
||||
@@ -16,6 +16,10 @@ admins: []
|
||||
# API 端口
|
||||
api:
|
||||
port: 5300
|
||||
# LangBot 统一管理所有需要 Webhook 监听的机器人地址
|
||||
# 这是显示在需要 Webhook 连接的机器人页面上的 Webhook地址前缀
|
||||
# 您可以根据自身网络环境修改
|
||||
webhook_prefix: 'http://127.0.0.1:5300'
|
||||
|
||||
# 命令配置
|
||||
command:
|
||||
|
||||
@@ -58,6 +58,12 @@ LangBot 是一个开源的大语言模型原生即时通信机器人开发平台
|
||||
| RAG | ✅ | 使用 Chroma 作为向量数据库 |
|
||||
| MCP | ✅ | 支持 Stdio 和 HTTP 两种方式 |
|
||||
|
||||
## 系统扩展性
|
||||
|
||||
- HTTP Service API: 支持通过基于 API key 鉴权的 HTTP API 接口访问 LangBot 各种实体。
|
||||
- Outgoing Webhook: 支持通过 Webhook 发送 LangBot 内部事件到外部系统。
|
||||
- 生产级插件系统: 基于跨进程通信技术和异步技术实现的生产级插件系统,支持多种组件扩展。
|
||||
|
||||
## 案例截图
|
||||
|
||||

|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
# 配置 HTTP 反向代理或通过网关访问 LangBot
|
||||
|
||||
LangBot 内部未支持内置 SSL 提供 HTTPS 服务,若您需要解析域名到 LangBot 实例,或需要使用 HTTPS 访问 LangBot WebUI 和各个机器人的 Webhook 地址,请参考此文档部署 NGINX 或 Caddy 实现 HTTP 反向代理。
|
||||
|
||||
您需要将 LangBot 部署在具有公网 IP 的主机上,并购买域名,将域名解析到主机公网 IP 上。
|
||||
|
||||
::: warning
|
||||
若您需要使用 QQ官方机器人、微信公众号、企业微信、Slack、LINE 等需要 Webhook 回调地址的机器人,请务必按照本文档配置 HTTP 反向代理。
|
||||
:::
|
||||
|
||||
## Caddy
|
||||
|
||||
Caddy 是一个现代的 HTTP 服务器,支持自动 HTTPS 证书申请和续期,支持反向代理,支持自动配置 DNS 解析。
|
||||
|
||||
[Caddy 安装文档](https://caddy2.dengxiaolong.com/docs/install)。选择对应自己操作系统的安装步骤,进行安装。
|
||||
|
||||
### 填写 Caddyfile
|
||||
|
||||
本文假设使用 ubuntu 系统部署 LangBot ,那么在系统中,Caddyfile 的默认位置为 `/etc/caddy/Caddyfile`。
|
||||
使用 vim 或 nano 编辑 Caddyfile ,Caddyfile文件填写为:
|
||||
|
||||
```json
|
||||
your.domain.com {
|
||||
reverse_proxy 127.0.0.1:5300
|
||||
}
|
||||
```
|
||||
|
||||
::: info
|
||||
若您的 Caddy 和 LangBot 使用容器部署,请查看[容器网络配置详解](/zh/workshop/network-details)
|
||||
:::
|
||||
|
||||
现在,您即可通过浏览器访问 `https://your.domain.com` 访问 LangBot WebUI。
|
||||
|
||||
### 设置机器人回调地址前缀
|
||||
|
||||
若您需要使用 QQ官方机器人、微信公众号、企业微信、Slack、LINE 等需要 Webhook 回调地址的机器人,请在 data/config.yaml 文件中设置`api.webhook_prefix`为您的域名。例如:`https://your.domain.com`。
|
||||
|
||||
之后,在机器人管理页面,您将看到正确显示的回调地址。
|
||||
|
||||
## NGINX
|
||||
|
||||
NGINX 也是常用的 HTTP 服务器和反向代理工具,可以用来实现 LangBot 的 HTTPS 接入。
|
||||
|
||||
### 安装 NGINX
|
||||
|
||||
在 Ubuntu 上可以通过以下命令安装 NGINX:
|
||||
|
||||
```bash
|
||||
sudo apt update
|
||||
sudo apt install nginx
|
||||
```
|
||||
|
||||
### 准备 SSL 证书
|
||||
|
||||
您可以使用 [Let’s Encrypt](https://letsencrypt.org/) 免费申请 SSL 证书。推荐使用 [Certbot](https://certbot.eff.org/) 工具来获取证书:
|
||||
|
||||
```bash
|
||||
sudo apt install certbot python3-certbot-nginx
|
||||
sudo certbot --nginx
|
||||
```
|
||||
|
||||
按照提示输入域名,证书申请与 NGINX 配置会自动完成。如果需要手动配置,可参考以下内容。
|
||||
|
||||
### 配置 NGINX 反向代理
|
||||
|
||||
编辑 NGINX 配置文件 `/etc/nginx/sites-available/langbot`(可以使用 vim 或 nano 编辑器):
|
||||
|
||||
```nginx
|
||||
server {
|
||||
listen 80;
|
||||
server_name your.domain.com;
|
||||
# 将 HTTP 流量重定向到 HTTPS
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
server_name your.domain.com;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/your.domain.com/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/your.domain.com/privkey.pem;
|
||||
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
ssl_ciphers HIGH:!aNULL:!MD5;
|
||||
|
||||
# 反向代理到 LangBot 实例
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:5300;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
将 `your.domain.com` 替换为您实际的域名。
|
||||
|
||||
启用此配置并重启 NGINX:
|
||||
|
||||
```bash
|
||||
sudo ln -s /etc/nginx/sites-available/langbot /etc/nginx/sites-enabled/langbot
|
||||
sudo nginx -t
|
||||
sudo systemctl reload nginx
|
||||
```
|
||||
|
||||
### 设置机器人回调地址前缀
|
||||
|
||||
同样,在 `data/config.yaml` 配置文件中将 `api.webhook_prefix` 设置为 `https://your.domain.com`,这样机器人 Webhook 回调地址才会正确。
|
||||
|
||||
完成上述配置后,即可通过 `https://your.domain.com` 安全访问 LangBot WebUI 和机器人 Webhook 服务。
|
||||