Perf/adapter docs (#73)

* perf: wecom.md

* stash

* docs: enhance platform feature documentation and add new platform features
This commit is contained in:
Junyan Qin (Chin)
2026-01-04 22:52:43 +08:00
committed by GitHub
parent 08bcce19db
commit 8390d2ebcd
33 changed files with 949 additions and 176 deletions
+6 -2
View File
@@ -38,7 +38,7 @@ export default defineConfig({
sitemap: {
hostname: 'https://docs.langbot.app',
},
locales: {
@@ -61,7 +61,11 @@ export default defineConfig({
items: [
{ text: "新手指引(必看)", link: "/zh/insight/guide" },
{ text: "社区资源", link: "/zh/insight/community" },
{ text: "特性规格", link: "/zh/insight/features" },
{
text: "特性规格", link: "/zh/insight/features", collapsed: true, items: [
{ text: "消息平台特性支持性", link: "/zh/insight/platform-features" }
]
},
],
},
{
Binary file not shown.

After

Width:  |  Height:  |  Size: 444 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 157 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

+57 -48
View File
@@ -1,70 +1,79 @@
# Deploy WeCom Bot
Deploy WeCom (Enterprise WeChat) bot to connect with LangBot.
Deploy the WeCom (Enterprise WeChat) bot to integrate with LangBot.
:::info
This integration method is for internal enterprise applications, used within the enterprise. If you need external customer service, please check the [WeCom Customer Service integration solution](wecomcs.md).
- This integration is for internal enterprise applications, used within your organization. If external customer support is needed, please refer to the [WeCom Customer Service integration solution](wecomcs.md).
- The WeCom callback address requires a public IP and domain name. We recommend you first follow [Configure HTTP Reverse Proxy](/en/workshop/production/proxy-and-ssl) to configure the LangBot callback address.
:::
## Record Corporate ID
Open the [WeCom Admin Portal](https://work.weixin.qq.com/), click `My Enterprise`, and record the `Corporate ID` at the bottom.
![Corp ID](/assets/image/zh/deploy/bots/wecom/wecom/03-corp-id.png)
## Create Bot
Enter the [WeCom Admin Portal](https://work.weixin.qq.com/), log in to your account, after entering the main page, click `App Management`, `Build Your Own`, `Create App`, fill in the basic information of the bot, after creation, you will see a page similar to this:
![Bot Page](/assets/image/zh/deploy/bots/wecom/wecom/wecom1.png)
Click `App Management`, then `Build Your Own`, and click `Create App`.
![App Management](/assets/image/zh/deploy/bots/wecom/wecom/01-wecom-apps.png)
Fill in the basic information for the bot:
![Create Application](/assets/image/zh/deploy/bots/wecom/wecom/02-create-app.png)
View and record the bot's secret:
![Bot Secret](/assets/image/zh/deploy/bots/wecom/wecom/04-bot-secret.png)
Get it from the WeCom client as prompted.
## Enable Contact Sync Permission
:::info
- This configuration is required for LangBot to support mass messaging. The related code can be found at libs/wecom_api/api.py.
- This feature has not been implemented yet as LangBot is still under development.
- This field can be filled with any random characters, but **cannot be empty**.
:::
Click `Security and Management`, then `Management Tools`, `Contact Sync`; configure the trusted IP by adding the IP address of the server where LangBot is deployed.
Click `View Secret` and record it - this is the contacts_secret (Contact Sync Secret).
![Contact Sync Secret](/assets/image/zh/deploy/bots/wecom/wecom/08-contact-secret.png)
## Create Bot on LangBot
On the LangBot bot page, click `Create Bot`, enter a name, select `WeCom`, and fill in the Corporate ID, Bot Secret, and Contact Sync Secret.
![Create WeCom Bot](/assets/image/zh/deploy/bots/wecom/wecom/05-fill-in-corpid-secret.png)
Click submit to enter the bot edit page, then click enable. At this point you'll see the Webhook callback address—copy it:
![Webhook Callback Address](/assets/image/zh/deploy/bots/wecom/wecom/06-webhook-callback-address.png)
## Set Callback Address
### Get WeCom Configuration Items
Return to the WeCom bot admin page, click `Receive Messages`, `Set API Reception`, and paste LangBot's Webhook callback address into the `URL` field:
1. Open the WeCom Admin Portal homepage, click `My Enterprise`, and record the Enterprise ID at the bottom.
![Set API Receiver](/assets/image/zh/deploy/bots/wecom/wecom/07-set-api-receiver.png)
![Enterprise ID](/assets/image/zh/deploy/bots/wecom/wecom/wecom2.png)
Click to randomly generate the Token and EncodingAESKey, and record them. **Keep this page open.** Go back to the LangBot WeCom bot configuration page, enter the Token and EncodingAESKey, and click Save.
2. Enable Contact Sync Permission
![Save WeCom Bot](/assets/image/zh/deploy/bots/wecom/wecom/09-save-wecom-bot.png)
:::info
- This configuration item is for implementing LangBot's mass messaging feature, the specific code is located in libs/wecom_api/api.py.
- LangBot is still under development, so the functionality related to this configuration item has not been implemented yet.
- This configuration item can be filled with random characters, but **cannot be empty**.
:::
Return to the **page where you just filled in the Webhook callback address**, and click Save to complete the configuration. If you see **request URL failed**, please carefully double-check your configuration.
![Contact Permission](/assets/image/zh/deploy/bots/wecom/wecom/wecom5.png)
## Configure Corporate Trusted IP
Click `Security and Management`, `Management Tools`, `Contact Sync`
Go back to this application's admin page, find `Enterprise Trusted IP` at the bottom, and add the IP address of your LangBot deployment server.
![Contact Sync Secret](/assets/image/zh/deploy/bots/wecom/wecom/wecom3.jpg)
![Corp Trusted IP](/assets/image/zh/deploy/bots/wecom/wecom/10-corp-trusted-ip.png)
Click `View Secret`, record it, this is the contacts_secret (Contact Sync Secret).
Click Save.
3. Click `App Management`, find the bot you just created, view the bot's secret, and record it.
## FAQ
![Bot Secret](/assets/image/zh/deploy/bots/wecom/wecom/wecom4.png)
At this point, you have obtained three configuration items: corpid (Enterprise ID), secret (Bot Secret), and contacts_secret (Contact Sync Secret).
### Configure Callback Address
Enter the bot page.
Click `Enterprise Trusted IP` at the bottom and add the server where LangBot is deployed.
Click `Receive Messages`, `Set API Reception`, and start filling in the server message reception configuration.
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.
:::
![Webhook Callback Address](/assets/image/zh/deploy/bots/wecom/wecom/wecom6.png)
Click to randomly generate the Token and EncodingAESKey, and record them
## Connect to LangBot
![Connect to LangBot](/assets/image/zh/deploy/bots/wecom/wecom/connect_to_langbot.png)
## Save Callback Address
When the five configuration items above have been correctly obtained and accurately filled into the WeCom adapter, then **start LangBot**.
Return to the callback address configuration page and click save. If the above configuration items are filled in correctly, the save will be successful, which means that WeCom and LangBot can communicate (deployment successful). If you see **openapi request callback address failed**, please triple-check that your configuration items are filled in correctly.
Q: Can't find the bot chat in WeCom?
A: Go to the app's detail page in WeCom admin, click `Features` > `Send Message` > `Send Message`, choose your own account, send a message, and you will see the bot in your chat window.
+20 -15
View File
@@ -6,11 +6,12 @@ LangBot is an open-source LLM native instant messaging robot development platfor
| Platform | Status | Remarks |
| --- | --- | --- |
| Personal QQ | ✅ | |
| QQ Official API | ✅ | |
| Personal QQ | ✅ | Supported by third-party applications that implement the OneBot11 protocol, supports QQ personal private and group chats |
| QQ Official Bot | ✅ | QQ Official Bot, supports channels, private chats, and group chats |
| WeCom | ✅ | |
| WeComCS | ✅ | |
| WeComIntelligentBot | ✅ | Support streaming output |
| WeCom Intelligent Bot | ✅ | Support streaming output |
| WeCom Customer Service | ✅ | |
| WeChat Official Account | ✅ | |
| Lark | ✅ | Support streaming output |
| DingTalk | ✅ | Support streaming output |
| Discord | ✅ | |
@@ -22,6 +23,8 @@ LangBot is an open-source LLM native instant messaging robot development platfor
🚧: In development
For platform-specific feature support, please check [this document](/en/insight/platform-features).
## Model and LLMOps Platform Support
| Provider/Service | Status | Remarks |
@@ -32,22 +35,23 @@ LangBot is an open-source LLM native instant messaging robot development platfor
| [Anthropic](https://www.anthropic.com/) | ✅ | |
| [xAI](https://x.ai/) | ✅ | |
| [Zhipu AI](https://open.bigmodel.cn/) | ✅ | |
| [ShengSuanYun](https://www.shengsuanyun.com/?from=CH_KYIPP758) | ✅ | Global LLM aggregation platform (Recommended) |
| [CompShare](https://www.compshare.cn/?ytag=GPU_YY-gh_langbot) | ✅ | LLM and GPU resource platform |
| [PPIO](https://ppio.com/user/register?invited_by=QJKFYD&utm_source=github_langbot) | ✅ | LLM and GPU resource platform |
| [302.AI](https://share.302.ai/SuTG99) | ✅ | LLM gateway (MaaS) |
| [Google Gemini](https://aistudio.google.com/prompts/new_chat) | ✅ | |
| [Dify](https://dify.ai) | ✅ | LLMOps platform |
| [n8n](https://n8n.io/) | ✅ | LLMOps platform |
| [Langflow](https://langflow.org/) | ✅ | LLMOps platform |
| [PPIO](https://ppio.com/user/register?invited_by=QJKFYD&utm_source=github_langbot) | ✅ | LLM and GPU resource platform |
| [ShengSuanYun](https://www.shengsuanyun.com/login?code=7DS2QLH5) | ✅ | LLM and GPU resource platform |
| [302.AI](https://share.302.ai/SuTG99) | ✅ | LLM gateway(MaaS) |
| [Google Gemini](https://aistudio.google.com/prompts/new_chat) | ✅ | |
| [Ollama](https://ollama.com/) | ✅ | Local LLM running platform |
| [LMStudio](https://lmstudio.ai/) | ✅ | Local LLM running platform |
| [GiteeAI](https://ai.gitee.com/) | ✅ | LLM interface gateway(MaaS) |
| [SiliconFlow](https://siliconflow.cn/) | ✅ | LLM gateway(MaaS) |
| [Aliyun Bailian](https://bailian.console.aliyun.com/) | ✅ | LLM gateway(MaaS), LLMOps platform |
| [Volc Engine Ark](https://console.volcengine.com/ark/region:ark+cn-beijing/model?vendor=Bytedance&view=LIST_VIEW) | ✅ | LLM gateway(MaaS), LLMOps platform |
| [ModelScope](https://modelscope.cn/docs/model-service/API-Inference/intro) | ✅ | LLM gateway(MaaS) |
| [Coze](https://coze.com) | ✅ | LLMOps platform |
| [GiteeAI](https://ai.gitee.com/) | ✅ | LLM interface gateway (MaaS) |
| [SiliconFlow](https://siliconflow.cn/) | ✅ | LLM gateway (MaaS) |
| [Aliyun Bailian](https://bailian.console.aliyun.com/) | ✅ | LLM gateway (MaaS), LLMOps platform |
| [Volc Engine Ark](https://console.volcengine.com/ark/region:ark+cn-beijing/model?vendor=Bytedance&view=LIST_VIEW) | ✅ | LLM gateway (MaaS), LLMOps platform |
| [ModelScope](https://modelscope.cn/docs/model-service/API-Inference/intro) | ✅ | LLM gateway (MaaS) |
| [TBox (Ant TreasureBox)](https://tbox.cn/) | ✅ | LLMOps platform |
| [Coze](https://coze.cn) | ✅ | LLMOps platform |
## LLM Application Paradigm Implementation
@@ -75,4 +79,5 @@ LangBot is an open-source LLM native instant messaging robot development platfor
![private_chat](/assets/image/zh/insight/private_chat.png)
![group_chat](/assets/image/zh/insight/group_chat.png)
![group_chat](/assets/image/zh/insight/group_chat.png)
+229
View File
@@ -0,0 +1,229 @@
# Platform Feature Support
The following is a list of features we have implemented and tested for each platform. If you encounter unexpected behavior, please feel free to report it to [GitHub Issues](https://github.com/langbot-app/LangBot/issues) or directly submit a Pull Request to help fix it.
## OneBot v11
### Receive
| Feature | Status | Remarks |
| --- | --- | --- |
| Receive private messages | ✅ | |
| Receive group mention messages | ✅ | |
| Receive group regular messages | ✅ | |
| Receive image messages | ✅ | |
| Receive voice messages | ✅ | |
| Receive file messages | ✅ | |
| Receive rich text messages | ✅ | Text and image combined |
| Get private message event user name | ✅ | |
| Get group message event group name | ✅ | |
| Get group message event sender name | ✅ | |
### Send
| Feature | Status | Remarks |
| --- | --- | --- |
| Reply to private messages | ✅ | |
| Reply to group messages | ✅ | |
| Reply with image messages | ✅ | |
| Reply with voice messages | ✅ | |
| Reply with file messages | ✅ | |
| Reply with rich text messages | ✅ | Text and image combined |
| Send proactive messages | ✅ | |
| Send streaming response | ❌ | |
## QQ Official Bot
## WeCom (Internal Application)
### Receive
| Feature | Status | Remarks |
| --- | --- | --- |
| Receive private messages | ✅ | |
| Receive group mention messages | ❌ | WeCom internal application does not support adding to groups |
| Receive group regular messages | ❌ | |
| Receive image messages | ✅ | |
| Receive voice messages | ✅ | |
| Receive file messages | ✅ | |
| Receive rich text messages | ❌ | |
| Get private message event user name | ✅ | |
| Get group message event group name | ❌ | |
| Get group message event sender name | ❌ | |
### Send
| Feature | Status | Remarks |
| --- | --- | --- |
| Reply to private messages | ✅ | |
| Reply to group messages | ❌ | |
| Reply with image messages | ✅ | |
| Reply with voice messages | ✅ | |
| Reply with file messages | ✅ | |
| Reply with rich text messages | ❌ | |
| Send proactive messages | ✅ | |
| Send streaming response | ❌ | |
## WeCom (Customer Service)
## WeCom Intelligent Bot
## WeChat Official Account
## Lark
### Receive
| Feature | Status | Remarks |
| --- | --- | --- |
| Receive private messages | ✅ | |
| Receive group mention messages | ✅ | |
| Receive group regular messages | ❌ | Lark only supports receiving messages that mention the bot |
| Receive image messages | ✅ | |
| Receive voice messages | ❌ | Lark does not have voice messages |
| Receive file messages | ✅ | |
| Receive rich text messages | ✅ | Text and image combined |
| Get private message event user name | ❌ | Lark does not support getting user name |
| Get group message event group name | ❌ | Lark does not support getting group name |
| Get group message event sender name | ❌ | Lark does not support getting sender name |
### Send
| Feature | Status | Remarks |
| --- | --- | --- |
| Reply to private messages | ✅ | |
| Reply to group messages | ✅ | |
| Reply with image messages | ✅ | |
| Reply with voice messages | ❌ | |
| Reply with file messages | ❌ | |
| Reply with rich text messages | ❌ | |
| Send proactive messages | ✅ | |
| Send streaming response | ✅ | |
## DingTalk
### Receive
| Feature | Status | Remarks |
| --- | --- | --- |
| Receive private messages | ✅ | |
| Receive group mention messages | ✅ | |
| Receive group regular messages | ❌ | DingTalk only supports receiving messages that mention the bot |
| Receive image messages | ✅ | |
| Receive voice messages | ✅ | |
| Receive file messages | ✅ | |
| Receive rich text messages | ✅ | Text and image combined |
| Get private message event user name | ✅ | |
| Get group message event group name | ✅ | |
| Get group message event sender name | ✅ | |
### Send
| Feature | Status | Remarks |
| --- | --- | --- |
| Reply to private messages | ✅ | |
| Reply to group messages | ✅ | |
| Reply with image messages | ✅ | |
| Reply with voice messages | ❌ | |
| Reply with file messages | ❌ | |
| Reply with rich text messages | ✅ | Text and image combined |
| Send proactive messages | ✅ | |
| Send streaming response | ✅ | |
## KOOK
P.S. Sending voice and file messages has errors not fixed yet
### Receive
| Feature | Status | Remarks |
| --- | --- | --- |
| Receive private messages | ✅ | |
| Receive group mention messages | ✅ | |
| Receive group regular messages | ✅ | |
| Receive image messages | ✅ | |
| Receive voice messages | ✅ | |
| Receive file messages | ✅ | |
| Receive rich text messages | ✅ | Text and image combined |
| Get private message event user name | ✅ | |
| Get group message event group name | ✅ | |
| Get group message event sender name | ✅ | |
### Send
| Feature | Status | Remarks |
| --- | --- | --- |
| Reply to private messages | ✅ | |
| Reply to group messages | ✅ | |
| Reply with image messages | ✅ | |
| Reply with voice messages | ❌ | KOOK does not support replying with voice messages |
| Reply with file messages | ❌ | |
| Reply with rich text messages | ✅ | Text and image combined |
| Send proactive messages | ✅ | |
| Send streaming response | ❌ | |
## Discord
### Receive
| Feature | Status | Remarks |
| --- | --- | --- |
| Receive private messages | ✅ | |
| Receive group mention messages | ✅ | |
| Receive group regular messages | ✅ | |
| Receive image messages | ✅ | |
| Receive voice messages | ❌ | |
| Receive file messages | ✅ | |
| Receive rich text messages | ✅ | Text and image combined |
| Get private message event user name | ✅ | |
| Get group message event group name | ✅ | |
| Get group message event sender name | ✅ | |
### Send
| Feature | Status | Remarks |
| --- | --- | --- |
| Reply to private messages | ✅ | |
| Reply to group messages | ✅ | |
| Reply with image messages | ✅ | Sent as file attachment |
| Reply with voice messages | ✅ | Sent as file attachment |
| Reply with file messages | ✅ | |
| Reply with rich text messages | ✅ | Text and file combined |
| Send proactive messages | ✅ | |
| Send streaming response | ❌ | |
## Telegram
P.S. Not tested
### Receive
| Feature | Status | Remarks |
| --- | --- | --- |
| Receive private messages | ✅ | |
| Receive group mention messages | ✅ | |
| Receive group regular messages | ✅ | |
| Receive image messages | ✅ | |
| Receive voice messages | ❌ | |
| Receive file messages | ✅ | |
| Receive rich text messages | ✅ | |
| Get private message event user name | ✅ | |
| Get group message event group name | ✅ | |
| Get group message event sender name | ✅ | |
### Send
| Feature | Status | Remarks |
| --- | --- | --- |
| Reply to private messages | ✅ | |
| Reply to group messages | ✅ | |
| Reply with image messages | ✅ | |
| Reply with voice messages | ✅ | |
| Reply with file messages | ✅ | |
| Reply with rich text messages | ✅ | |
| Send proactive messages | ✅ | |
| Send streaming response | ❌ | |
## Slack
## LINE
+4 -4
View File
@@ -14,14 +14,14 @@ LangBot supports multiple messaging platforms, and each platform has different `
This is a message chain containing one Plain component (Hello World) and one Image component (Usagi).
The definitions of message chains and message chain components are located in `langbot_plugin.api.entities.platform.message`.
The definitions of message chains and message chain components are located in `langbot_plugin.api.entities.builtin.platform.message`.
### Constructing Message Chains
Please first import the `langbot_plugin.api.entities.platform.message` package to use the message components within it.
Please first import the `langbot_plugin.api.entities.builtin.platform.message` package to use the message components within it.
```python
from langbot_plugin.api.entities.platform.message import *
from langbot_plugin.api.entities.builtin.platform.message import *
# Build a message containing text "Hello LangBot" and an image (from URL)
msg_chain = MessageChain([
@@ -56,7 +56,7 @@ Currently supported message chain components:
- Not supported on many platforms, not recommended
- `File` - File message
When creating components, named parameters must be used. For specific usage, you can check the definitions in the source code `langbot_plugin.api.entities.platform.message`.
When creating components, named parameters must be used. For specific usage, you can check the definitions in the source code `langbot_plugin.api.entities.builtin.platform.message`.
## Other Entities
+29 -8
View File
@@ -27,12 +27,16 @@ class PersonMessageReceived(BaseEventModel):
"""Sender ID"""
sender_id: typing.Union[int, str]
"""Sender ID"""
"""Sender ID, same as launcher_id in private chat"""
message_event: platform_events.PersonMessage
"""Original message event object. Contains sender information."""
message_chain: platform_message.MessageChain = pydantic.Field(
serialization_alias="message_chain"
)
"""Raw message chain"""
"""Message chain"""
class GroupMessageReceived(BaseEventModel):
"""When any group chat message is received"""
@@ -48,10 +52,13 @@ class GroupMessageReceived(BaseEventModel):
sender_id: typing.Union[int, str]
"""Sender ID"""
message_event: platform_events.GroupMessage
"""Original message event object. Contains group and sender information."""
message_chain: platform_message.MessageChain = pydantic.Field(
serialization_alias="message_chain"
)
"""Raw message chain"""
"""Message chain"""
```
### *NormalMessageReceived
@@ -65,18 +72,24 @@ class PersonNormalMessageReceived(BaseEventModel):
event_name: str = "PersonNormalMessageReceived"
launcher_type: str
"""Launcher object type (person)"""
launcher_id: typing.Union[int, str]
"""Launcher object ID"""
sender_id: typing.Union[int, str]
"""Sender ID, same as launcher_id in private chat"""
text_message: str
"""Message text"""
message_event: platform_events.PersonMessage
"""Original message event object. Contains sender information."""
message_chain: platform_message.MessageChain = pydantic.Field(
serialization_alias="message_chain"
)
"""Raw message chain"""
"""Message chain"""
# ========== Settable Attributes ==========
@@ -84,7 +97,8 @@ class PersonNormalMessageReceived(BaseEventModel):
"""Modified message text, langbot_plugin.api.entities.builtin.provider.message.ContentElement type"""
reply_message_chain: typing.Optional[platform_message.MessageChain] = None
"""Reply message component list, only effective when preventing default behavior"""
"""Direct reply message chain, only effective when preventing default behavior"""
class GroupNormalMessageReceived(BaseEventModel):
"""Triggered when a group chat normal message that should be processed is determined"""
@@ -92,18 +106,24 @@ class GroupNormalMessageReceived(BaseEventModel):
event_name: str = "GroupNormalMessageReceived"
launcher_type: str
"""Launcher object type (group)"""
launcher_id: typing.Union[int, str]
"""Group ID"""
sender_id: typing.Union[int, str]
"""Sender ID"""
text_message: str
"""Message text"""
message_event: platform_events.GroupMessage
"""Original message event object. Contains group and sender information."""
message_chain: platform_message.MessageChain = pydantic.Field(
serialization_alias="message_chain"
)
"""Raw message chain"""
"""Message chain"""
# ========== Settable Attributes ==========
@@ -111,7 +131,7 @@ class GroupNormalMessageReceived(BaseEventModel):
"""Modified message text, langbot_plugin.api.entities.builtin.provider.message.ContentElement type"""
reply_message_chain: typing.Optional[platform_message.MessageChain] = None
"""Reply message component list, only effective when preventing default behavior"""
"""Direct reply message chain, only effective when preventing default behavior"""
```
### *CommandSent
@@ -220,11 +240,12 @@ class PromptPreProcessing(BaseEventModel):
event_name: str = "PromptPreProcessing"
session_name: str
"""Session name, format is person_1234567890 or group_1234567890"""
# ========== Settable Attributes ==========
default_prompt: list[typing.Union[provider_message.Message, provider_message.MessageChunk]]
"""Scenario preset for this conversation, can be modified, langbot_plugin.api.entities.builtin.provider.message.Message or langbot_plugin.api.entities.builtin.provider.message.MessageChunk type"""
"""Scenario preset (system prompt) for this conversation, can be modified, langbot_plugin.api.entities.builtin.provider.message.Message or langbot_plugin.api.entities.builtin.provider.message.MessageChunk type"""
prompt: list[typing.Union[provider_message.Message, provider_message.MessageChunk]]
"""Existing message records for this conversation, can be modified, langbot_plugin.api.entities.builtin.provider.message.Message or langbot_plugin.api.entities.builtin.provider.message.MessageChunk type"""
+40 -31
View File
@@ -1,26 +1,35 @@
# WeCom ボットのデプロイ
WeCom(Enterprise WeChat)ボットをデプロイして LangBot に接続します。
WeCom(企業微信)ボットをデプロイして LangBot に接続します。
:::info
この統合方法は、企業内部アプリケーション用であり、企業内で使用されます。外部カスタマーサービスが必要な場合は、[WeCom Customer Service 統合ソリューション](wecomcs.md)を確認してください。
- この統合方法は、企業内部アプリケーション用であり、企業内で使用されます。外部カスタマーサービスが必要な場合は、[WeCom Customer Service 統合ソリューション](wecomcs.md)を確認してください。
- WeCom コールバックアドレスにはパブリック IP とドメイン名が必要です。まず [HTTP リバースプロキシの設定](/ja/workshop/production/proxy-and-ssl)を参照して LangBot コールバックアドレスを設定することをお勧めします。
:::
## 企業 ID の記録
[WeCom 管理ポータル](https://work.weixin.qq.com/)を開き、`私の企業`をクリックして、一番下の`企業 ID`を記録します。
![Corp ID](/assets/image/zh/deploy/bots/wecom/wecom/03-corp-id.png)
## ボットの作成
[WeCom Admin Portal](https://work.weixin.qq.com/)に入り、アカウントにログインし、メインページに入った後、「アプリ管理」、「独自の構築」、「アプリを作成」をクリックし、ボットの基本情報を入力します。作成後、次のようなページが表示されます:
![Bot Page](/assets/image/zh/deploy/bots/wecom/wecom/wecom1.png)
`アプリ管理`、`自社開発`、`アプリを作成`をクリックします。
## コールバックアドレスの設定
![App Management](/assets/image/zh/deploy/bots/wecom/wecom/01-wecom-apps.png)
### WeCom 設定項目の取得
ボットの基本情報を入力します:
1. WeCom Admin Portal ホームページを開き、「私の企業」をクリックし、下部の Enterprise ID を記録します。
![Create Application](/assets/image/zh/deploy/bots/wecom/wecom/02-create-app.png)
![Enterprise ID](/assets/image/zh/deploy/bots/wecom/wecom/wecom2.png)
ボットのシークレット(Secret)を確認して記録します:
2. 連絡先同期権限を有効にします
![Bot Secret](/assets/image/zh/deploy/bots/wecom/wecom/04-bot-secret.png)
WeCom クライアントからプロンプトに従って取得します。
## 連絡先同期権限の有効化
:::info
- この設定項目は、LangBot の一斉送信機能を実装するためのものです。具体的なコードは libs/wecom_api/api.py にあります。
@@ -28,43 +37,43 @@ WeCom(Enterprise WeChat)ボットをデプロイして LangBot に接続し
- この設定項目はランダムな文字で埋めることができますが、**空にすることはできません**。
:::
![Contact Permission](/assets/image/zh/deploy/bots/wecom/wecom/wecom5.png)
`セキュリティと管理`、`管理ツール`、`連絡先同期`をクリックします。まず信頼できる IP を設定し、LangBot がデプロイされているサーバーの IP を追加します。
「セキュリティと管理」、「管理ツール」、「連絡先同期」をクリックします
`Secret を表示`をクリックして記録します。これが contacts_secret(連絡先同期 Secret)です。
![Contact Sync Secret](/assets/image/zh/deploy/bots/wecom/wecom/wecom3.jpg)
![Contact Sync Secret](/assets/image/zh/deploy/bots/wecom/wecom/08-contact-secret.png)
「Secret を表示」をクリックして記録します。これが contacts_secret(連絡先同期 Secret)です。
## LangBot でボットを作成
3. 「アプリ管理」をクリックし、作成したばかりのボットを見つけ、ボットの secret を表示して記録します。
LangBot のボットページで、`ボットを作成`をクリックし、名前を入力し、`企業微信`を選択します。このステップでは、企業 ID、ボットシークレット、連絡先同期 Secret のみを入力する必要があります。
![Bot Secret](/assets/image/zh/deploy/bots/wecom/wecom/wecom4.png)
![Create WeCom Bot](/assets/image/zh/deploy/bots/wecom/wecom/05-fill-in-corpid-secret.png)
この時点で、3 つの設定項目を取得しました:corpid(Enterprise ID)、secret(Bot Secret)、contacts_secret(Contact Sync Secret)。
送信をクリックして、ボット編集ページにジャンプし、有効化をクリックします。この時点で Webhook コールバックアドレスが表示されるので、コピーします:
### コールバックアドレスの設定
![Webhook Callback Address](/assets/image/zh/deploy/bots/wecom/wecom/06-webhook-callback-address.png)
ボットページに入ります。
## コールバックアドレスの設定
下部の「企業信頼 IP」をクリックし、LangBot がデプロイされているサーバーを追加します。
WeCom のボット管理ページに戻り、`メッセージを受信`、`API 受信を設定`をクリックし、LangBot の Webhook コールバックアドレスを`URL`に入力します:
「メッセージを受信」、「API 受信を設定」をクリックし、サーバーメッセージ受信設定を開始します。
![Set API Receiver](/assets/image/zh/deploy/bots/wecom/wecom/07-set-api-receiver.png)
LangBot ホームページで、対応するボットを有効にして選択し、設定ページをクリックして入り、Webhook コールバックアドレスをコピーして URL に入力します。
Token と EncodingAESKey の`ランダム生成`をクリックして記録し、**このページを開いたままにします**。LangBot の WeCom ボット設定ページに戻り、Token と EncodingAESKey を入力して、保存をクリックします。
::: info
まず、[HTTP リバースプロキシの設定](/en/workshop/production/proxy-and-ssl)を参照して LangBot コールバックアドレスを設定することをお勧めします。
:::
![Save WeCom Bot](/assets/image/zh/deploy/bots/wecom/wecom/09-save-wecom-bot.png)
![Webhook Callback Address](/assets/image/zh/deploy/bots/wecom/wecom/wecom6.png)
**先ほど Webhook コールバックアドレスを入力したページ**に戻り、保存をクリックして設定を完了します。**リクエスト URL 失敗**が表示された場合は、設定項目が正しく入力されているか再度確認してください。
Token と EncodingAESKey をランダムに生成するためにクリックし、それらを記録します
## アプリの企業信頼 IP の設定
## LangBot に接続
このアプリの管理ページに戻り、下部の`企業信頼 IP`を見つけ、LangBot がデプロイされているサーバーの IP を追加します。
![Connect to LangBot](/assets/image/zh/deploy/bots/wecom/wecom/connect_to_langbot.png)
![Corp Trusted IP](/assets/image/zh/deploy/bots/wecom/wecom/10-corp-trusted-ip.png)
## コールバックアドレスの保存
上記の 5 つの設定項目が正しく取得され、WeCom アダプターに正確に入力されたら、**LangBot を起動します**。
保存をクリックして完了です。
コールバックアドレス設定ページに戻り、保存をクリックします。上記の設定項目が正しく入力されている場合、保存は成功します。これは、WeCom と LangBot が通信できることを意味します(デプロイ成功)。**openapi request callback address failed** が表示された場合は、設定項目が正しく入力されているかどうかを 3 回確認してください。
## よくある質問
Q: WeCom でボットのチャットが見つかりませんか?
A: WeCom 管理ページのこのアプリの詳細ページに移動し、`機能`->`メッセージを送信`->`メッセージを送信`をクリックし、自分のアカウントを選択してメッセージを送信すると、自分のチャットウィンドウでボットが表示されます。
+15 -10
View File
@@ -6,11 +6,12 @@ LangBotは、オープンソースのLLMネイティブインスタントメッ
| プラットフォーム | ステータス | 備考 |
| --- | --- | --- |
| 個人QQ | ✅ | |
| QQ公式API | ✅ | |
| WeCom | ✅ | |
| WeComCS | ✅ | |
| WeComIntelligentBot | ✅ | ストリーミング出力をサポート |
| QQ個人アカウント | ✅ | OneBot11プロトコルをサポートするサードパーティアプリケーションによりサポート、QQ個人プライベートチャットとグループチャットをサポート |
| QQ公式ボット | ✅ | QQ公式ボット、チャンネル、プライベートチャット、グループチャットをサポート |
| 企業微信 | ✅ | |
| 企業微信インテリジェントボット | ✅ | ストリーミング出力をサポート |
| 企業微信カスタマーサービス | ✅ | |
| WeChat公式アカウント | ✅ | |
| Lark | ✅ | ストリーミング出力をサポート |
| DingTalk | ✅ | ストリーミング出力をサポート |
| Discord | ✅ | |
@@ -22,6 +23,8 @@ LangBotは、オープンソースのLLMネイティブインスタントメッ
🚧: 開発中
各インスタントメッセージングプラットフォームの機能サポートについては、[こちらのドキュメント](/ja/insight/platform-features)をご覧ください。
## モデルとLLMOpsプラットフォームのサポート
| プロバイダー/サービス | ステータス | 備考 |
@@ -32,14 +35,14 @@ LangBotは、オープンソースのLLMネイティブインスタントメッ
| [Anthropic](https://www.anthropic.com/) | ✅ | |
| [xAI](https://x.ai/) | ✅ | |
| [Zhipu AI](https://open.bigmodel.cn/) | ✅ | |
| [ShengSuanYun](https://www.shengsuanyun.com/?from=CH_KYIPP758) | ✅ | グローバルLLM集約プラットフォーム(推奨) |
| [CompShare](https://www.compshare.cn/?ytag=GPU_YY-gh_langbot) | ✅ | LLMおよびGPUリソースプラットフォーム |
| [PPIO](https://ppio.com/user/register?invited_by=QJKFYD&utm_source=github_langbot) | ✅ | LLMおよびGPUリソースプラットフォーム |
| [302.AI](https://share.302.ai/SuTG99) | ✅ | LLMゲートウェイ(MaaS) |
| [Google Gemini](https://aistudio.google.com/prompts/new_chat) | ✅ | |
| [Dify](https://dify.ai) | ✅ | LLMOpsプラットフォーム |
| [n8n](https://n8n.io/) | ✅ | LLMOpsプラットフォーム |
| [Langflow](https://langflow.org/) | ✅ | LLMOpsプラットフォーム |
| [PPIO](https://ppio.com/user/register?invited_by=QJKFYD&utm_source=github_langbot) | ✅ | LLMおよびGPUリソースプラットフォーム |
| [ShengSuanYun](https://www.shengsuanyun.com/login?code=7DS2QLH5) | ✅ | LLMおよびGPUリソースプラットフォーム |
| [302.AI](https://share.302.ai/SuTG99) | ✅ | LLMゲートウェイ(MaaS) |
| [Google Gemini](https://aistudio.google.com/prompts/new_chat) | ✅ | |
| [Ollama](https://ollama.com/) | ✅ | ローカルLLM実行プラットフォーム |
| [LMStudio](https://lmstudio.ai/) | ✅ | ローカルLLM実行プラットフォーム |
| [GiteeAI](https://ai.gitee.com/) | ✅ | LLMインターフェースゲートウェイ(MaaS) |
@@ -47,7 +50,8 @@ LangBotは、オープンソースのLLMネイティブインスタントメッ
| [Aliyun Bailian](https://bailian.console.aliyun.com/) | ✅ | LLMゲートウェイ(MaaS)、LLMOpsプラットフォーム |
| [Volc Engine Ark](https://console.volcengine.com/ark/region:ark+cn-beijing/model?vendor=Bytedance&view=LIST_VIEW) | ✅ | LLMゲートウェイ(MaaS)、LLMOpsプラットフォーム |
| [ModelScope](https://modelscope.cn/docs/model-service/API-Inference/intro) | ✅ | LLMゲートウェイ(MaaS) |
| [Coze](https://coze.com) | ✅ | LLMOpsプラットフォーム |
| [TBox(蚂蚁百宝箱)](https://tbox.cn/) | ✅ | LLMOpsプラットフォーム |
| [Coze](https://coze.cn) | ✅ | LLMOpsプラットフォーム |
## LLMアプリケーションパラダイムの実装
@@ -76,3 +80,4 @@ LangBotは、オープンソースのLLMネイティブインスタントメッ
![private_chat](/assets/image/zh/insight/private_chat.png)
![group_chat](/assets/image/zh/insight/group_chat.png)
+229
View File
@@ -0,0 +1,229 @@
# 各メッセージプラットフォームの機能サポート
以下は各プラットフォームで実装およびテスト済みの機能リストです。予期しない動作が発生した場合は、[GitHub Issues](https://github.com/langbot-app/LangBot/issues)に報告するか、Pull Requestを直接提出して修正にご協力ください。
## OneBot v11
### 受信
| 機能 | ステータス | 備考 |
| --- | --- | --- |
| プライベートメッセージの受信 | ✅ | |
| グループメンションメッセージの受信 | ✅ | |
| グループ通常メッセージの受信 | ✅ | |
| 画像メッセージの受信 | ✅ | |
| 音声メッセージの受信 | ✅ | |
| ファイルメッセージの受信 | ✅ | |
| リッチテキストメッセージの受信 | ✅ | テキストと画像の組み合わせ |
| プライベートメッセージイベントのユーザー名取得 | ✅ | |
| グループメッセージイベントのグループ名取得 | ✅ | |
| グループメッセージイベントの送信者名取得 | ✅ | |
### 送信
| 機能 | ステータス | 備考 |
| --- | --- | --- |
| プライベートメッセージへの返信 | ✅ | |
| グループメッセージへの返信 | ✅ | |
| 画像メッセージでの返信 | ✅ | |
| 音声メッセージでの返信 | ✅ | |
| ファイルメッセージでの返信 | ✅ | |
| リッチテキストメッセージでの返信 | ✅ | テキストと画像の組み合わせ |
| 能動的メッセージの送信 | ✅ | |
| ストリーミングレスポンスの送信 | ❌ | |
## QQ公式ボット
## 企業微信(内部アプリケーション)
### 受信
| 機能 | ステータス | 備考 |
| --- | --- | --- |
| プライベートメッセージの受信 | ✅ | |
| グループメンションメッセージの受信 | ❌ | 企業微信内部アプリケーションはグループ追加をサポートしていません |
| グループ通常メッセージの受信 | ❌ | |
| 画像メッセージの受信 | ✅ | |
| 音声メッセージの受信 | ✅ | |
| ファイルメッセージの受信 | ✅ | |
| リッチテキストメッセージの受信 | ❌ | |
| プライベートメッセージイベントのユーザー名取得 | ✅ | |
| グループメッセージイベントのグループ名取得 | ❌ | |
| グループメッセージイベントの送信者名取得 | ❌ | |
### 送信
| 機能 | ステータス | 備考 |
| --- | --- | --- |
| プライベートメッセージへの返信 | ✅ | |
| グループメッセージへの返信 | ❌ | |
| 画像メッセージでの返信 | ✅ | |
| 音声メッセージでの返信 | ✅ | |
| ファイルメッセージでの返信 | ✅ | |
| リッチテキストメッセージでの返信 | ❌ | |
| 能動的メッセージの送信 | ✅ | |
| ストリーミングレスポンスの送信 | ❌ | |
## 企業微信(カスタマーサービス)
## 企業微信インテリジェントボット
## WeChat公式アカウント
## Lark
### 受信
| 機能 | ステータス | 備考 |
| --- | --- | --- |
| プライベートメッセージの受信 | ✅ | |
| グループメンションメッセージの受信 | ✅ | |
| グループ通常メッセージの受信 | ❌ | Larkはボットをメンションしたメッセージのみ受信可能 |
| 画像メッセージの受信 | ✅ | |
| 音声メッセージの受信 | ❌ | Larkには音声メッセージがありません |
| ファイルメッセージの受信 | ✅ | |
| リッチテキストメッセージの受信 | ✅ | テキストと画像の組み合わせ |
| プライベートメッセージイベントのユーザー名取得 | ❌ | Larkはユーザー名の取得をサポートしていません |
| グループメッセージイベントのグループ名取得 | ❌ | Larkはグループ名の取得をサポートしていません |
| グループメッセージイベントの送信者名取得 | ❌ | Larkは送信者名の取得をサポートしていません |
### 送信
| 機能 | ステータス | 備考 |
| --- | --- | --- |
| プライベートメッセージへの返信 | ✅ | |
| グループメッセージへの返信 | ✅ | |
| 画像メッセージでの返信 | ✅ | |
| 音声メッセージでの返信 | ❌ | |
| ファイルメッセージでの返信 | ❌ | |
| リッチテキストメッセージでの返信 | ❌ | |
| 能動的メッセージの送信 | ✅ | |
| ストリーミングレスポンスの送信 | ✅ | |
## DingTalk
### 受信
| 機能 | ステータス | 備考 |
| --- | --- | --- |
| プライベートメッセージの受信 | ✅ | |
| グループメンションメッセージの受信 | ✅ | |
| グループ通常メッセージの受信 | ❌ | DingTalkはボットをメンションしたメッセージのみ受信可能 |
| 画像メッセージの受信 | ✅ | |
| 音声メッセージの受信 | ✅ | |
| ファイルメッセージの受信 | ✅ | |
| リッチテキストメッセージの受信 | ✅ | テキストと画像の組み合わせ |
| プライベートメッセージイベントのユーザー名取得 | ✅ | |
| グループメッセージイベントのグループ名取得 | ✅ | |
| グループメッセージイベントの送信者名取得 | ✅ | |
### 送信
| 機能 | ステータス | 備考 |
| --- | --- | --- |
| プライベートメッセージへの返信 | ✅ | |
| グループメッセージへの返信 | ✅ | |
| 画像メッセージでの返信 | ✅ | |
| 音声メッセージでの返信 | ❌ | |
| ファイルメッセージでの返信 | ❌ | |
| リッチテキストメッセージでの返信 | ✅ | テキストと画像の組み合わせ |
| 能動的メッセージの送信 | ✅ | |
| ストリーミングレスポンスの送信 | ✅ | |
## KOOK
P.S. 音声とファイルの送信にエラーがあり、未修正
### 受信
| 機能 | ステータス | 備考 |
| --- | --- | --- |
| プライベートメッセージの受信 | ✅ | |
| グループメンションメッセージの受信 | ✅ | |
| グループ通常メッセージの受信 | ✅ | |
| 画像メッセージの受信 | ✅ | |
| 音声メッセージの受信 | ✅ | |
| ファイルメッセージの受信 | ✅ | |
| リッチテキストメッセージの受信 | ✅ | テキストと画像の組み合わせ |
| プライベートメッセージイベントのユーザー名取得 | ✅ | |
| グループメッセージイベントのグループ名取得 | ✅ | |
| グループメッセージイベントの送信者名取得 | ✅ | |
### 送信
| 機能 | ステータス | 備考 |
| --- | --- | --- |
| プライベートメッセージへの返信 | ✅ | |
| グループメッセージへの返信 | ✅ | |
| 画像メッセージでの返信 | ✅ | |
| 音声メッセージでの返信 | ❌ | KOOKは音声メッセージでの返信をサポートしていません |
| ファイルメッセージでの返信 | ❌ | |
| リッチテキストメッセージでの返信 | ✅ | テキストと画像の組み合わせ |
| 能動的メッセージの送信 | ✅ | |
| ストリーミングレスポンスの送信 | ❌ | |
## Discord
### 受信
| 機能 | ステータス | 備考 |
| --- | --- | --- |
| プライベートメッセージの受信 | ✅ | |
| グループメンションメッセージの受信 | ✅ | |
| グループ通常メッセージの受信 | ✅ | |
| 画像メッセージの受信 | ✅ | |
| 音声メッセージの受信 | ❌ | |
| ファイルメッセージの受信 | ✅ | |
| リッチテキストメッセージの受信 | ✅ | テキストと画像の組み合わせ |
| プライベートメッセージイベントのユーザー名取得 | ✅ | |
| グループメッセージイベントのグループ名取得 | ✅ | |
| グループメッセージイベントの送信者名取得 | ✅ | |
### 送信
| 機能 | ステータス | 備考 |
| --- | --- | --- |
| プライベートメッセージへの返信 | ✅ | |
| グループメッセージへの返信 | ✅ | |
| 画像メッセージでの返信 | ✅ | ファイル添付として送信 |
| 音声メッセージでの返信 | ✅ | ファイル添付として送信 |
| ファイルメッセージでの返信 | ✅ | |
| リッチテキストメッセージでの返信 | ✅ | テキストとファイルの組み合わせ |
| 能動的メッセージの送信 | ✅ | |
| ストリーミングレスポンスの送信 | ❌ | |
## Telegram
P.S. 未テスト
### 受信
| 機能 | ステータス | 備考 |
| --- | --- | --- |
| プライベートメッセージの受信 | ✅ | |
| グループメンションメッセージの受信 | ✅ | |
| グループ通常メッセージの受信 | ✅ | |
| 画像メッセージの受信 | ✅ | |
| 音声メッセージの受信 | ❌ | |
| ファイルメッセージの受信 | ✅ | |
| リッチテキストメッセージの受信 | ✅ | |
| プライベートメッセージイベントのユーザー名取得 | ✅ | |
| グループメッセージイベントのグループ名取得 | ✅ | |
| グループメッセージイベントの送信者名取得 | ✅ | |
### 送信
| 機能 | ステータス | 備考 |
| --- | --- | --- |
| プライベートメッセージへの返信 | ✅ | |
| グループメッセージへの返信 | ✅ | |
| 画像メッセージでの返信 | ✅ | |
| 音声メッセージでの返信 | ✅ | |
| ファイルメッセージでの返信 | ✅ | |
| リッチテキストメッセージでの返信 | ✅ | |
| 能動的メッセージの送信 | ✅ | |
| ストリーミングレスポンスの送信 | ❌ | |
## Slack
## LINE
+4 -4
View File
@@ -14,14 +14,14 @@ LangBotは複数のメッセージングプラットフォームをサポート
これは、1つのPlainコンポーネント(Hello World)と1つのImageコンポーネント(Usagi)を含むメッセージチェーンです。
メッセージチェーンとメッセージチェーンコンポーネントの定義は、`langbot_plugin.api.entities.platform.message`にあります。
メッセージチェーンとメッセージチェーンコンポーネントの定義は、`langbot_plugin.api.entities.builtin.platform.message`にあります。
### メッセージチェーンの構築
まず、`langbot_plugin.api.entities.platform.message`パッケージをインポートして、その中のメッセージコンポーネントを使用してください。
まず、`langbot_plugin.api.entities.builtin.platform.message`パッケージをインポートして、その中のメッセージコンポーネントを使用してください。
```python
from langbot_plugin.api.entities.platform.message import *
from langbot_plugin.api.entities.builtin.platform.message import *
# テキスト「Hello LangBot」と画像(URLから)を含むメッセージを構築
msg_chain = MessageChain([
@@ -56,7 +56,7 @@ msg_chain = MessageChain([
- 多くのプラットフォームでサポートされていないため、推奨されません
- `File` - ファイルメッセージ
コンポーネントを作成する際は、名前付きパラメータを使用する必要があります。具体的な使用方法については、ソースコード`langbot_plugin.api.entities.platform.message`の定義を確認してください。
コンポーネントを作成する際は、名前付きパラメータを使用する必要があります。具体的な使用方法については、ソースコード`langbot_plugin.api.entities.builtin.platform.message`の定義を確認してください。
## その他のエンティティ
+32 -11
View File
@@ -4,7 +4,7 @@
[[toc]]
:::
LangBotプラグインはパイプラインイベントを登録して処理できます。使用方法については、[コンポーネント: イベントリスナー](/en/plugin/dev/components/event-listener)を参照してください。
LangBotプラグインはパイプラインイベントを登録して処理できます。使用方法については、[コンポーネント: イベントリスナー](/ja/plugin/dev/components/event-listener)を参照してください。
## イベント一覧
@@ -27,12 +27,16 @@ class PersonMessageReceived(BaseEventModel):
"""送信者ID"""
sender_id: typing.Union[int, str]
"""送信者ID"""
"""送信者ID、プライベートチャットの場合はlauncher_idと同じ"""
message_event: platform_events.PersonMessage
"""元のメッセージイベントオブジェクト。送信者情報を含みます。"""
message_chain: platform_message.MessageChain = pydantic.Field(
serialization_alias="message_chain"
)
"""生のメッセージチェーン"""
"""メッセージチェーン"""
class GroupMessageReceived(BaseEventModel):
"""グループチャットメッセージを受信したとき"""
@@ -48,10 +52,13 @@ class GroupMessageReceived(BaseEventModel):
sender_id: typing.Union[int, str]
"""送信者ID"""
message_event: platform_events.GroupMessage
"""元のメッセージイベントオブジェクト。グループと送信者情報を含みます。"""
message_chain: platform_message.MessageChain = pydantic.Field(
serialization_alias="message_chain"
)
"""生のメッセージチェーン"""
"""メッセージチェーン"""
```
### *NormalMessageReceived
@@ -65,18 +72,24 @@ class PersonNormalMessageReceived(BaseEventModel):
event_name: str = "PersonNormalMessageReceived"
launcher_type: str
"""起動元オブジェクトタイプ(person)"""
launcher_id: typing.Union[int, str]
"""起動元オブジェクトID"""
sender_id: typing.Union[int, str]
"""送信者ID、プライベートチャットの場合はlauncher_idと同じ"""
text_message: str
"""メッセージテキスト"""
message_event: platform_events.PersonMessage
"""元のメッセージイベントオブジェクト。送信者情報を含みます。"""
message_chain: platform_message.MessageChain = pydantic.Field(
serialization_alias="message_chain"
)
"""生のメッセージチェーン"""
"""メッセージチェーン"""
# ========== 設定可能な属性 ==========
@@ -84,7 +97,8 @@ class PersonNormalMessageReceived(BaseEventModel):
"""変更されたメッセージテキスト、langbot_plugin.api.entities.builtin.provider.message.ContentElement型"""
reply_message_chain: typing.Optional[platform_message.MessageChain] = None
"""返信メッセージコンポーネントリスト、デフォルト動作を防止した場合のみ有効"""
"""直接返信メッセージチェーン、デフォルト動作を防止した場合のみ有効"""
class GroupNormalMessageReceived(BaseEventModel):
"""処理すべきグループチャット通常メッセージが判定されたときにトリガーされる"""
@@ -92,18 +106,24 @@ class GroupNormalMessageReceived(BaseEventModel):
event_name: str = "GroupNormalMessageReceived"
launcher_type: str
"""起動元オブジェクトタイプ(group)"""
launcher_id: typing.Union[int, str]
"""グループID"""
sender_id: typing.Union[int, str]
"""送信者ID"""
text_message: str
"""メッセージテキスト"""
message_event: platform_events.GroupMessage
"""元のメッセージイベントオブジェクト。グループと送信者情報を含みます。"""
message_chain: platform_message.MessageChain = pydantic.Field(
serialization_alias="message_chain"
)
"""生のメッセージチェーン"""
"""メッセージチェーン"""
# ========== 設定可能な属性 ==========
@@ -111,13 +131,13 @@ class GroupNormalMessageReceived(BaseEventModel):
"""変更されたメッセージテキスト、langbot_plugin.api.entities.builtin.provider.message.ContentElement型"""
reply_message_chain: typing.Optional[platform_message.MessageChain] = None
"""返信メッセージコンポーネントリスト、デフォルト動作を防止した場合のみ有効"""
"""直接返信メッセージチェーン、デフォルト動作を防止した場合のみ有効"""
```
### *CommandSent
:::warning 注意
使用は推奨されなくなりました。代わりに[コンポーネント: Command](/en/plugin/dev/components/command)を使用してください。
使用は推奨されなくなりました。代わりに[コンポーネント: Command](/ja/plugin/dev/components/command)を使用してください。
:::
グループチャットまたはプライベートチャットでコマンドを受信したときにトリガーされます。
@@ -220,11 +240,12 @@ class PromptPreProcessing(BaseEventModel):
event_name: str = "PromptPreProcessing"
session_name: str
"""セッション名、形式は person_1234567890 または group_1234567890"""
# ========== 設定可能な属性 ==========
default_prompt: list[typing.Union[provider_message.Message, provider_message.MessageChunk]]
"""この会話のシナリオプリセット、変更可能、langbot_plugin.api.entities.builtin.provider.message.Messageまたはlangbot_plugin.api.entities.builtin.provider.message.MessageChunk型"""
"""この会話のシナリオプリセット(システムプロンプト)、変更可能、langbot_plugin.api.entities.builtin.provider.message.Messageまたはlangbot_plugin.api.entities.builtin.provider.message.MessageChunk型"""
prompt: list[typing.Union[provider_message.Message, provider_message.MessageChunk]]
"""この会話の既存メッセージレコード、変更可能、langbot_plugin.api.entities.builtin.provider.message.Messageまたはlangbot_plugin.api.entities.builtin.provider.message.MessageChunk型"""
@@ -239,7 +260,7 @@ class PromptPreProcessing(BaseEventModel):
...
```
イベント処理メソッドには`EventContext`オブジェクトが渡され、イベントコンテキスト情報が含まれます。このオブジェクトには[リクエストAPI](/en/plugin/dev/apis/common)とイベントコンテキスト固有のAPIの両方があります。以下は、イベントコンテキスト固有のAPIのリストです:
イベント処理メソッドには`EventContext`オブジェクトが渡され、イベントコンテキスト情報が含まれます。このオブジェクトには[リクエストAPI](/ja/plugin/dev/apis/common)とイベントコンテキスト固有のAPIの両方があります。以下は、イベントコンテキスト固有のAPIのリストです:
### 元のイベント属性の取得
+37 -39
View File
@@ -3,24 +3,33 @@
部署企业微信机器人接入 LangBot 。
:::info
此种接入方式为企业内部自建应用,是在企业内部使用的,若需要对外接待,请查看[企业微信客服接入方案](wecomcs.md)。
- 此种接入方式为企业内部自建应用,是在企业内部使用的,若需要对外接待,请查看[企业微信客服接入方案](wecomcs.md)。
- 企业微信回调地址需要公网IP和域名,推荐您先参照[配置 HTTP 反向代理](/zh/workshop/production/proxy-and-ssl)来配置 LangBot 回调地址。
:::
## 记录企业ID
打开[企业微信管理后台](https://work.weixin.qq.com/),点击`我的企业`,记录下最下面的`企业ID`。
![Corp ID](/assets/image/zh/deploy/bots/wecom/wecom/03-corp-id.png)
## 创建机器人
进入[企业微信管理后台](https://work.weixin.qq.com/),登陆账号,进入主页面后,点击` 应用管理 `,` 自建 `,` 创建应用 `,填写机器人基本信息,创建好之后,会出现类似这样的界面:
![机器人页面](/assets/image/zh/deploy/bots/wecom/wecom/wecom1.png)
点击` 应用管理 `,` 自建 `,` 创建应用`
## 设置回调地址
![App Management](/assets/image/zh/deploy/bots/wecom/wecom/01-wecom-apps.png)
### 获取企业微信配置项
填写机器人基本信息:
1. 打开企业微信管理后台主页,点击`我的企业`,记录下最下面的企业ID。
![Create Application](/assets/image/zh/deploy/bots/wecom/wecom/02-create-app.png)
![企业ID](/assets/image/zh/deploy/bots/wecom/wecom/wecom2.png)
查看并记录机器人密钥(Secret):
2. 开启通讯录同步权限
![Bot Secret](/assets/image/zh/deploy/bots/wecom/wecom/04-bot-secret.png)
从企业微信客户端根据提示获取。
## 开启通讯录同步权限
:::info
- 此配置项是为了实现 LangBot 的群发消息,具体代码位于libs/wecom_api/api.py 。
@@ -28,54 +37,43 @@
- 此配置项可以填写入随机字符,**不能为空**。
:::
![通讯录权限](/assets/image/zh/deploy/bots/wecom/wecom/wecom5.png)
点击`安全与管理`,`管理工具`,`通讯录同步`
![通讯录同步secret](/assets/image/zh/deploy/bots/wecom/wecom/wecom3.jpg)
点击`安全与管理`,`管理工具`,`通讯录同步`;先配置可信IP,添加部署 LangBot 的服务器IP。
点击`查看secret`,记录下来,这是 contacts_secret(通讯录同步 secret)。
3. 点击`应用管理`,找到刚才创建的机器人,查看机器人的 secret ,记录下来。
![Contact Sync Secret](/assets/image/zh/deploy/bots/wecom/wecom/08-contact-secret.png)
![机器人secret](/assets/image/zh/deploy/bots/wecom/wecom/wecom4.png)
## 在 LangBot 新建机器人
至此,已经获得了三个配置项,分别是 corpid(企业ID),secret(机器人 secret),contacts_secret(通讯录同步 secret)。
在 LangBot 机器人页面,点击`创建机器人`,填入名称,选择`企业微信`,此步骤只需要填入 企业ID 和 机器人密钥,以及通讯录同步 secret。
### 配置回调地址
![Create WeCom Bot](/assets/image/zh/deploy/bots/wecom/wecom/05-fill-in-corpid-secret.png)
进入机器人页面。
点击提交,跳转到机器人编辑页面,点击启用;此时即可看到 Webhook 回调地址,复制下来:
点击最下方的`企业可信IP`,将部署 LangBot 的服务器添加进去。
![Webhook Callback Address](/assets/image/zh/deploy/bots/wecom/wecom/06-webhook-callback-address.png)
点击` 接收消息 `,` 设置API接收 `,开始填写接收服务器消息配置。
在 LangBot 主页中,启用并选择对应的机器人,点击进入配置页面,复制其中的 Webhook 回调地址,填写到 URL 中。
::: info
推荐您先参照[配置 HTTP 反向代理](/zh/workshop/production/proxy-and-ssl)来配置 LangBot 回调地址。
:::
![Webhook 回调地址](/assets/image/zh/deploy/bots/wecom/wecom/wecom6.png)
Token 和 EncodingAESKey 点击随机获取,并记录下来
## 对接 LangBot
![对接 LangBot](/assets/image/zh/deploy/bots/wecom/wecom/connect_to_langbot.png)
## 保存回调地址
当前面五个配置项已经正确获取,并且准确的填入到企业微信适配器中,那么**启动 LangBot**。
回到配置回调地址页面并且点击保存,如果以上的配置项填写正确,那么可以保存成功,这意味着企业微信和 LangBot 可以进行通信(部署成功),如果出现**openapi 请求回调地址不通过**,请再三检查你的配置项填写是否正确。
## 设置回调地址
回到企业微信的机器人管理页面,点击`接收消息`,`设置API接收`,将 LangBot 的 Webhook 回调地址填入`URL`中:
![Set API Receiver](/assets/image/zh/deploy/bots/wecom/wecom/07-set-api-receiver.png)
点击 Token 和 EncodingAESKey 的`随机获取`,并记录下来,**保持此页开启**。返回到 LangBot 的企微机器人配置页面,将 Token 和 EncodingAESKey 填入,点击保存。
![Save WeCom Bot](/assets/image/zh/deploy/bots/wecom/wecom/09-save-wecom-bot.png)
再回到**刚刚填写 Webhook 回调地址的页面**,点击保存即可配置完成;如果出现**请求URL失败**,请再三检查你的配置项填写是否正确。
## 配置应用的企业可信 IP
回到该应用到管理页,在下方找到`企业可信 IP`,添加部署 LangBot 的服务器IP。
![Corp Trusted IP](/assets/image/zh/deploy/bots/wecom/wecom/10-corp-trusted-ip.png)
点击保存即可。
## 常见问题
Q:企微上找不到机器人对话框?
A:可以到企微管理页面上该应用的详情页,点击`功能`->`发送消息`->`发消息`,选择自己账号,发送消息,即可在自己的对话框中看到机器人。
+2
View File
@@ -23,6 +23,8 @@ LangBot 是一个开源的大语言模型原生即时通信机器人开发平台
🚧: 正在开发中
各即时通信平台特性支持性请查看[此文档](/zh/insight/platform-features)。
## 模型和 LLMOps 平台支持性
| 供应商/服务 | 状态 | 备注 |
+229
View File
@@ -0,0 +1,229 @@
# 各消息平台特性支持性
以下是各平台我们已实现并测试的功能列表,如有预期之外的现象,欢迎即使反馈到[GitHub Issues](https://github.com/langbot-app/LangBot/issues) 或直接提出 Pull Request 帮助修复。
## OneBot v11
### 接收
| 功能点 | 状态 | 备注 |
| --- | --- | --- |
| 接收私聊消息 | ✅ | |
| 接收群聊提及消息 | ✅ | |
| 接收群聊普通消息 | ✅ | |
| 接收图片消息 | ✅ | |
| 接收语音消息 | ✅ | |
| 接收文件消息 | ✅ | |
| 接收富文本消息 | ✅ | 文本和图片结合 |
| 获取私聊消息事件用户名称 | ✅ | |
| 获取群聊消息事件群聊名称 | ✅ | |
| 获取群聊消息事件发送者名称 | ✅ | |
### 发送
| 功能点 | 状态 | 备注 |
| --- | --- | --- |
| 回复私聊消息 | ✅ | |
| 回复群聊消息 | ✅ | |
| 回复图片消息 | ✅ | |
| 回复语音消息 | ✅ | |
| 回复文件消息 | ✅ | |
| 回复富文本消息 | ✅ | 文本和图片结合 |
| 发送主动消息 | ✅ | |
| 发送流式响应 | ❌ | |
## QQ 官方机器人
## 企业微信(内部应用)
### 接收
| 功能点 | 状态 | 备注 |
| --- | --- | --- |
| 接收私聊消息 | ✅ | |
| 接收群聊提及消息 | ❌ | 企微内部应用不支持拉群 |
| 接收群聊普通消息 | ❌ | |
| 接收图片消息 | ✅ | |
| 接收语音消息 | ✅ | |
| 接收文件消息 | ✅ | |
| 接收富文本消息 | ❌ | |
| 获取私聊消息事件用户名称 | ✅ | |
| 获取群聊消息事件群聊名称 | ❌ | |
| 获取群聊消息事件发送者名称 | ❌ | |
### 发送
| 功能点 | 状态 | 备注 |
| --- | --- | --- |
| 回复私聊消息 | ✅ | |
| 回复群聊消息 | ❌ | |
| 回复图片消息 | ✅ | |
| 回复语音消息 | ✅ | |
| 回复文件消息 | ✅ | |
| 回复富文本消息 | ❌ | |
| 发送主动消息 | ✅ | |
| 发送流式响应 | ❌ | |
## 企业微信(对外客服)
## 企业微信智能机器人
## 微信公众号
## 飞书
### 接收
| 功能点 | 状态 | 备注 |
| --- | --- | --- |
| 接收私聊消息 | ✅ | |
| 接收群聊提及消息 | ✅ | |
| 接收群聊普通消息 | ❌ | 飞书仅支持接收提及机器人的消息 |
| 接收图片消息 | ✅ | |
| 接收语音消息 | ❌ | 飞书无语音消息 |
| 接收文件消息 | ✅ | |
| 接收富文本消息 | ✅ | 文本和图片结合 |
| 获取私聊消息事件用户名称 | ❌ | 飞书不支持获取用户名称 |
| 获取群聊消息事件群聊名称 | ❌ | 飞书不支持获取群聊名称 |
| 获取群聊消息事件发送者名称 | ❌ | 飞书不支持获取发送者名称 |
### 发送
| 功能点 | 状态 | 备注 |
| --- | --- | --- |
| 回复私聊消息 | ✅ | |
| 回复群聊消息 | ✅ | |
| 回复图片消息 | ✅ | |
| 回复语音消息 | ❌ | |
| 回复文件消息 | ❌ | |
| 回复富文本消息 | ❌ | |
| 发送主动消息 | ✅ | |
| 发送流式响应 | ✅ | |
## 钉钉
### 接收
| 功能点 | 状态 | 备注 |
| --- | --- | --- |
| 接收私聊消息 | ✅ | |
| 接收群聊提及消息 | ✅ | |
| 接收群聊普通消息 | ❌ | 钉钉仅支持接收提及机器人的消息 |
| 接收图片消息 | ✅ | |
| 接收语音消息 | ✅ | |
| 接收文件消息 | ✅ | |
| 接收富文本消息 | ✅ | 文本和图片结合 |
| 获取私聊消息事件用户名称 | ✅ | |
| 获取群聊消息事件群聊名称 | ✅ | |
| 获取群聊消息事件发送者名称 | ✅ | |
### 发送
| 功能点 | 状态 | 备注 |
| --- | --- | --- |
| 回复私聊消息 | ✅ | |
| 回复群聊消息 | ✅ | |
| 回复图片消息 | ✅ | |
| 回复语音消息 | ❌ | |
| 回复文件消息 | ❌ | |
| 回复富文本消息 | ✅ | 文本和图片结合 |
| 发送主动消息 | ✅ | |
| 发送流式响应 | ✅ | |
## KOOK
P.S. 发送语音和文件报错未修
### 接收
| 功能点 | 状态 | 备注 |
| --- | --- | --- |
| 接收私聊消息 | ✅ | |
| 接收群聊提及消息 | ✅ | |
| 接收群聊普通消息 | ✅ | |
| 接收图片消息 | ✅ | |
| 接收语音消息 | ✅ | |
| 接收文件消息 | ✅ | |
| 接收富文本消息 | ✅ | 文本和图片结合 |
| 获取私聊消息事件用户名称 | ✅ | |
| 获取群聊消息事件群聊名称 | ✅ | |
| 获取群聊消息事件发送者名称 | ✅ | |
### 发送
| 功能点 | 状态 | 备注 |
| --- | --- | --- |
| 回复私聊消息 | ✅ | |
| 回复群聊消息 | ✅ | |
| 回复图片消息 | ✅ | |
| 回复语音消息 | ❌ | KOOK不支持回复语音消息 |
| 回复文件消息 | ❌ | |
| 回复富文本消息 | ✅ | 文本和图片结合 |
| 发送主动消息 | ✅ | |
| 发送流式响应 | ❌ | |
## Discord
### 接收
| 功能点 | 状态 | 备注 |
| --- | --- | --- |
| 接收私聊消息 | ✅ | |
| 接收群聊提及消息 | ✅ | |
| 接收群聊普通消息 | ✅ | |
| 接收图片消息 | ✅ | |
| 接收语音消息 | ❌ | |
| 接收文件消息 | ✅ | |
| 接收富文本消息 | ✅ | 文本和图片结合 |
| 获取私聊消息事件用户名称 | ✅ | |
| 获取群聊消息事件群聊名称 | ✅ | |
| 获取群聊消息事件发送者名称 | ✅ | |
### 发送
| 功能点 | 状态 | 备注 |
| --- | --- | --- |
| 回复私聊消息 | ✅ | |
| 回复群聊消息 | ✅ | |
| 回复图片消息 | ✅ | 作为文件携带 |
| 回复语音消息 | ✅ | 作为文件携带 |
| 回复文件消息 | ✅ | |
| 回复富文本消息 | ✅ | 文本和文件结合 |
| 发送主动消息 | ✅ | |
| 发送流式响应 | ❌ | |
## Telegram
P.S. 未测试
### 接收
| 功能点 | 状态 | 备注 |
| --- | --- | --- |
| 接收私聊消息 | ✅ | |
| 接收群聊提及消息 | ✅ | |
| 接收群聊普通消息 | ✅ | |
| 接收图片消息 | ✅ | |
| 接收语音消息 | ❌ | |
| 接收文件消息 | ✅ | |
| 接收富文本消息 | ✅ | |
| 获取私聊消息事件用户名称 | ✅ | |
| 获取群聊消息事件群聊名称 | ✅ | |
| 获取群聊消息事件发送者名称 | ✅ | |
### 发送
| 功能点 | 状态 | 备注 |
| --- | --- | --- |
| 回复私聊消息 | ✅ | |
| 回复群聊消息 | ✅ | |
| 回复图片消息 | ✅ | |
| 回复语音消息 | ✅ | |
| 回复文件消息 | ✅ | |
| 回复富文本消息 | ✅ | |
| 发送主动消息 | ✅ | |
| 发送流式响应 | ❌ | |
## Slack
## LINE
+4 -4
View File
@@ -14,14 +14,14 @@ LangBot 支持多种消息平台,每个消息平台的`消息实体`格式均
这就是一个消息链,包含 一个 Plain 组件(Hello World)和 一个 Image 组件(乌萨奇)
消息链和消息链组件的定义位于`langbot_plugin.api.entities.platform.message`中。
消息链和消息链组件的定义位于`langbot_plugin.api.entities.builtin.platform.message`中。
### 构造消息链
请先引入`langbot_plugin.api.entities.platform.message`包,才能使用其中的消息组件。
请先引入`langbot_plugin.api.entities.builtin.platform.message`包,才能使用其中的消息组件。
```python
from langbot_plugin.api.entities.platform.message import *
from langbot_plugin.api.entities.builtin.platform.message import *
# 构建一个包含文字 Hello LangBot 和图片(从URL获取)的消息
msg_chain = MessageChain([
@@ -56,7 +56,7 @@ msg_chain = MessageChain([
- 在很多平台不受支持,不建议使用
- `File` 文件消息
创建组件时,须使用具名参数传入。具体使用方式可以查看源码`langbot_plugin.api.entities.platform.message`中的定义。
创建组件时,须使用具名参数传入。具体使用方式可以查看源码`langbot_plugin.api.entities.builtin.platform.message`中的定义。
## 其他实体
@@ -29,6 +29,9 @@ class PersonMessageReceived(BaseEventModel):
sender_id: typing.Union[int, str]
"""发送者ID,私聊情况下与 launcher_id 相同"""
message_event: platform_events.PersonMessage
"""原消息事件对象。包含发送者的信息。"""
message_chain: platform_message.MessageChain = pydantic.Field(
serialization_alias="message_chain"
)
@@ -49,6 +52,9 @@ class GroupMessageReceived(BaseEventModel):
sender_id: typing.Union[int, str]
"""发送者ID"""
message_event: platform_events.GroupMessage
"""原消息事件对象。包含群聊和发送者的信息。"""
message_chain: platform_message.MessageChain = pydantic.Field(
serialization_alias="message_chain"
)
@@ -77,6 +83,9 @@ class PersonNormalMessageReceived(BaseEventModel):
text_message: str
"""消息文本"""
message_event: platform_events.PersonMessage
"""原消息事件对象。包含发送者的信息。"""
message_chain: platform_message.MessageChain = pydantic.Field(
serialization_alias="message_chain"
)
@@ -108,6 +117,9 @@ class GroupNormalMessageReceived(BaseEventModel):
text_message: str
"""消息文本"""
message_event: platform_events.GroupMessage
"""原消息事件对象。包含群聊和发送者的信息。"""
message_chain: platform_message.MessageChain = pydantic.Field(
serialization_alias="message_chain"
)