mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-02 03:55:55 +00:00
feat: migration for wecom config
This commit is contained in:
33
pkg/core/migrations/m020_wecom_config.py
Normal file
33
pkg/core/migrations/m020_wecom_config.py
Normal file
@@ -0,0 +1,33 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from .. import migration
|
||||
|
||||
|
||||
@migration.migration_class("wecom-config", 20)
|
||||
class WecomConfigMigration(migration.Migration):
|
||||
"""迁移"""
|
||||
|
||||
async def need_migrate(self) -> bool:
|
||||
"""判断当前环境是否需要运行此迁移"""
|
||||
|
||||
for adapter in self.ap.platform_cfg.data['platform-adapters']:
|
||||
if adapter['adapter'] == 'wecom':
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
async def run(self):
|
||||
"""执行迁移"""
|
||||
self.ap.platform_cfg.data['platform-adapters'].append({
|
||||
"adapter": "wecom",
|
||||
"enable": False,
|
||||
"host": "0.0.0.0",
|
||||
"port": 2290,
|
||||
"corpid": "",
|
||||
"secret": "",
|
||||
"token": "",
|
||||
"EncodingAESKey": "",
|
||||
"contacts_secret": ""
|
||||
})
|
||||
|
||||
await self.ap.platform_cfg.dump_config()
|
||||
@@ -8,6 +8,7 @@ from ..migrations import m001_sensitive_word_migration, m002_openai_config_migra
|
||||
from ..migrations import m005_deepseek_cfg_completion, m006_vision_config, m007_qcg_center_url, m008_ad_fixwin_config_migrate, m009_msg_truncator_cfg
|
||||
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
|
||||
from ..migrations import m020_wecom_config
|
||||
|
||||
|
||||
@stage.stage_class("MigrationStage")
|
||||
|
||||
@@ -26,15 +26,15 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"adapter":"wecom",
|
||||
"enable":false,
|
||||
"host":"0.0.0.0",
|
||||
"port":5001,
|
||||
"corpid":"",
|
||||
"secret":"",
|
||||
"token":"",
|
||||
"EncodingAESKey":"",
|
||||
"contacts_secret":""
|
||||
"adapter": "wecom",
|
||||
"enable": false,
|
||||
"host": "0.0.0.0",
|
||||
"port": 2290,
|
||||
"corpid": "",
|
||||
"secret": "",
|
||||
"token": "",
|
||||
"EncodingAESKey": "",
|
||||
"contacts_secret": ""
|
||||
}
|
||||
],
|
||||
"track-function-calls": true,
|
||||
|
||||
Reference in New Issue
Block a user