Skip to content

Commit

Permalink
chore: migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
RockChinQ committed Jan 29, 2025
1 parent ea254d5 commit ac9cef8
Show file tree
Hide file tree
Showing 4 changed files with 130 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

## ✨ Features

- 💬 大模型对话、Agent:支持多种大模型,适配群聊和私聊;具有多轮对话、工具调用、多模态能力,并深度适配 [Dify](https://dify.ai)。目前支持 QQ、QQ频道、企业微信,后续还将支持微信、WhatsApp、Discord等平台。
- 💬 大模型对话、Agent:支持多种大模型,适配群聊和私聊;具有多轮对话、工具调用、多模态能力,并深度适配 [Dify](https://dify.ai)。目前支持 QQ、QQ频道、企业微信、飞书,后续还将支持微信、WhatsApp、Discord等平台。
- 🛠️ 高稳定性、功能完备:原生支持访问控制、限速、敏感词过滤等机制;配置简单,支持多种部署方式。
- 🧩 插件扩展、活跃社区:支持事件驱动、组件扩展等插件机制;丰富生态,目前已有数十个[插件](https://docs.langbot.app/plugin/plugin-intro.html)
- 😻 [New] Web 管理面板:支持通过浏览器管理 LangBot 实例,具体支持功能,查看[文档](https://docs.langbot.app/webui/intro.html)
Expand Down Expand Up @@ -83,6 +83,7 @@
| QQ 个人号 || QQ 个人号私聊、群聊 |
| QQ 官方机器人 || QQ 频道机器人,支持频道、私聊、群聊 |
| 企业微信 || |
| 飞书 || |
| 钉钉 | 🚧 | |

🚧: 正在开发中
Expand Down
29 changes: 29 additions & 0 deletions pkg/core/migrations/m021_lark_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from __future__ import annotations

from .. import migration


@migration.migration_class("lark-config", 21)
class LarkConfigMigration(migration.Migration):
"""迁移"""

async def need_migrate(self) -> bool:
"""判断当前环境是否需要运行此迁移"""

for adapter in self.ap.platform_cfg.data['platform-adapters']:
if adapter['adapter'] == 'lark':
return False

return True

async def run(self):
"""执行迁移"""
self.ap.platform_cfg.data['platform-adapters'].append({
"adapter": "lark",
"enable": False,
"app_id": "cli_abcdefgh",
"app_secret": "XXXXXXXXXX",
"bot_name": "LangBot"
})

await self.ap.platform_cfg.dump_config()
7 changes: 7 additions & 0 deletions templates/platform.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@
"token": "",
"EncodingAESKey": "",
"contacts_secret": ""
},
{
"adapter": "lark",
"enable": false,
"app_id": "cli_abcdefgh",
"app_secret": "XXXXXXXXXX",
"bot_name": "LangBot"
}
],
"track-function-calls": true,
Expand Down
92 changes: 92 additions & 0 deletions templates/schema/platform.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,98 @@
]
}
}
},
{
"title": "企业微信适配器",
"description": "用于接入企业微信",
"properties": {
"adapter": {
"type": "string",
"const": "wecom"
},
"enable": {
"type": "boolean",
"default": false,
"description": "是否启用此适配器",
"layout": {
"comp": "switch",
"props": {
"color": "primary"
}
}
},
"host": {
"type": "string",
"default": "0.0.0.0",
"description": "监听的IP地址"
},
"port": {
"type": "integer",
"default": 2290,
"description": "监听的端口"
},
"corpid": {
"type": "string",
"default": "",
"description": "企业微信的corpid"
},
"secret": {
"type": "string",
"default": "",
"description": "企业微信的secret"
},
"token": {
"type": "string",
"default": "",
"description": "企业微信的token"
},
"EncodingAESKey": {
"type": "string",
"default": "",
"description": "企业微信的EncodingAESKey"
},
"contacts_secret": {
"type": "string",
"default": "",
"description": "企业微信的contacts_secret"
}
}
},
{
"title": "飞书适配器",
"description": "用于接入飞书",
"properties": {
"adapter": {
"type": "string",
"const": "lark"
},
"enable": {
"type": "boolean",
"default": false,
"description": "是否启用此适配器",
"layout": {
"comp": "switch",
"props": {
"color": "primary"
}
}
},
"app_id": {
"type": "string",
"default": "",
"description": "飞书的app_id"
},
"app_secret": {
"type": "string",
"default": "",
"description": "飞书的app_secret"
},
"bot_name": {
"type": "string",
"default": "",
"description": "飞书的bot_name"
}
}
}
]
}
Expand Down

0 comments on commit ac9cef8

Please sign in to comment.