mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-08-13 14:10:59 +00:00
chore: migrations for officialaccount adapter
This commit is contained in:
@@ -0,0 +1,32 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from .. import migration
|
||||||
|
|
||||||
|
|
||||||
|
@migration.migration_class("wx-official-account-config", 27)
|
||||||
|
class WXOfficialAccountConfigMigration(migration.Migration):
|
||||||
|
"""迁移"""
|
||||||
|
|
||||||
|
async def need_migrate(self) -> bool:
|
||||||
|
"""判断当前环境是否需要运行此迁移"""
|
||||||
|
|
||||||
|
for adapter in self.ap.platform_cfg.data['platform-adapters']:
|
||||||
|
if adapter['adapter'] == 'officialaccount':
|
||||||
|
return False
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
async def run(self):
|
||||||
|
"""执行迁移"""
|
||||||
|
self.ap.platform_cfg.data['platform-adapters'].append({
|
||||||
|
"adapter": "officialaccount",
|
||||||
|
"enable": False,
|
||||||
|
"token": "",
|
||||||
|
"EncodingAESKey": "",
|
||||||
|
"AppID": "",
|
||||||
|
"AppSecret": "",
|
||||||
|
"host": "0.0.0.0",
|
||||||
|
"port": 2287
|
||||||
|
})
|
||||||
|
|
||||||
|
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 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 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 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, m027_wx_official_account_config
|
||||||
|
|
||||||
@stage.stage_class("MigrationStage")
|
@stage.stage_class("MigrationStage")
|
||||||
class MigrationStage(stage.BootingStage):
|
class MigrationStage(stage.BootingStage):
|
||||||
|
|||||||
@@ -68,11 +68,11 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"adapter":"officialaccount",
|
"adapter":"officialaccount",
|
||||||
"enable": true,
|
"enable": false,
|
||||||
"token": "",
|
"token": "",
|
||||||
"EncodingAESKey":"",
|
"EncodingAESKey":"",
|
||||||
"AppSecret":"",
|
|
||||||
"AppID":"",
|
"AppID":"",
|
||||||
|
"AppSecret":"",
|
||||||
"host": "0.0.0.0",
|
"host": "0.0.0.0",
|
||||||
"port": 2287
|
"port": 2287
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -331,6 +331,51 @@
|
|||||||
"description": "gewechat 的 token"
|
"description": "gewechat 的 token"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "微信公众号适配器",
|
||||||
|
"description": "用于接入微信公众号",
|
||||||
|
"properties": {
|
||||||
|
"adapter": {
|
||||||
|
"type": "string",
|
||||||
|
"const": "officialaccount"
|
||||||
|
},
|
||||||
|
"enable": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "是否启用此适配器"
|
||||||
|
},
|
||||||
|
"token": {
|
||||||
|
"type": "string",
|
||||||
|
"default": "",
|
||||||
|
"description": "微信公众号的token"
|
||||||
|
},
|
||||||
|
"EncodingAESKey": {
|
||||||
|
"type": "string",
|
||||||
|
"default": "",
|
||||||
|
"description": "微信公众号的EncodingAESKey"
|
||||||
|
},
|
||||||
|
"AppID": {
|
||||||
|
"type": "string",
|
||||||
|
"default": "",
|
||||||
|
"description": "微信公众号的AppID"
|
||||||
|
},
|
||||||
|
"AppSecret": {
|
||||||
|
"type": "string",
|
||||||
|
"default": "",
|
||||||
|
"description": "微信公众号的AppSecret"
|
||||||
|
},
|
||||||
|
"host": {
|
||||||
|
"type": "string",
|
||||||
|
"default": "0.0.0.0",
|
||||||
|
"description": "监听的IP地址"
|
||||||
|
},
|
||||||
|
"port": {
|
||||||
|
"type": "integer",
|
||||||
|
"default": 2287,
|
||||||
|
"description": "监听的端口"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user