mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-04 21:06:03 +00:00
chore: migrations
This commit is contained in:
@@ -29,7 +29,8 @@ required_deps = {
|
||||
"lark_oapi": "lark-oapi",
|
||||
"discord": "discord.py",
|
||||
"cryptography": "cryptography",
|
||||
"gewechat_client": "gewechat-client"
|
||||
"gewechat_client": "gewechat-client",
|
||||
"dingtalk_stream": "dingtalk_stream",
|
||||
}
|
||||
|
||||
|
||||
|
||||
30
pkg/core/migrations/m031_dingtalk_config.py
Normal file
30
pkg/core/migrations/m031_dingtalk_config.py
Normal file
@@ -0,0 +1,30 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from .. import migration
|
||||
|
||||
|
||||
@migration.migration_class("dingtalk-config", 31)
|
||||
class DingTalkConfigMigration(migration.Migration):
|
||||
"""迁移"""
|
||||
|
||||
async def need_migrate(self) -> bool:
|
||||
"""判断当前环境是否需要运行此迁移"""
|
||||
|
||||
for adapter in self.ap.platform_cfg.data['platform-adapters']:
|
||||
if adapter['adapter'] == 'dingtalk':
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
async def run(self):
|
||||
"""执行迁移"""
|
||||
self.ap.platform_cfg.data['platform-adapters'].append({
|
||||
"adapter": "dingtalk",
|
||||
"enable": False,
|
||||
"client_id": "",
|
||||
"client_secret": "",
|
||||
"robot_code": "",
|
||||
"robot_name": ""
|
||||
})
|
||||
|
||||
await self.ap.platform_cfg.dump_config()
|
||||
@@ -9,7 +9,7 @@ from ..migrations import m005_deepseek_cfg_completion, m006_vision_config, m007_
|
||||
from ..migrations import m010_ollama_requester_config, m011_command_prefix_config, m012_runner_config, m013_http_api_config, m014_force_delay_config
|
||||
from ..migrations import m015_gitee_ai_config, m016_dify_service_api, m017_dify_api_timeout_params, m018_xai_config, m019_zhipuai_config
|
||||
from ..migrations import m020_wecom_config, m021_lark_config, m022_lmstudio_config, m023_siliconflow_config, m024_discord_config, m025_gewechat_config
|
||||
from ..migrations import m026_qqofficial_config
|
||||
from ..migrations import m026_qqofficial_config, m031_dingtalk_config
|
||||
|
||||
@stage.stage_class("MigrationStage")
|
||||
class MigrationStage(stage.BootingStage):
|
||||
|
||||
@@ -331,6 +331,47 @@
|
||||
"description": "gewechat 的 token"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "钉钉适配器",
|
||||
"description": "用于接入钉钉",
|
||||
"properties": {
|
||||
"adapter": {
|
||||
"type": "string",
|
||||
"const": "dingtalk"
|
||||
},
|
||||
"enable": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "是否启用此适配器",
|
||||
"layout": {
|
||||
"comp": "switch",
|
||||
"props": {
|
||||
"color": "primary"
|
||||
}
|
||||
}
|
||||
},
|
||||
"client_id": {
|
||||
"type": "string",
|
||||
"default": "",
|
||||
"description": "钉钉的client_id"
|
||||
},
|
||||
"client_secret": {
|
||||
"type": "string",
|
||||
"default": "",
|
||||
"description": "钉钉的client_secret"
|
||||
},
|
||||
"robot_code": {
|
||||
"type": "string",
|
||||
"default": "",
|
||||
"description": "钉钉的robot_code"
|
||||
},
|
||||
"robot_name": {
|
||||
"type": "string",
|
||||
"default": "",
|
||||
"description": "钉钉的robot_name"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user