mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-07 14:26:03 +00:00
feat: 添加多个可视化编辑schema
This commit is contained in:
@@ -125,9 +125,11 @@ class Application:
|
||||
import signal
|
||||
|
||||
def signal_handler(sig, frame):
|
||||
for task in tasks:
|
||||
for task in self.asyncio_tasks:
|
||||
task.cancel()
|
||||
self.logger.info("程序退出.")
|
||||
# 结束当前事件循环
|
||||
self.event_loop.stop()
|
||||
exit(0)
|
||||
|
||||
signal.signal(signal.SIGINT, signal_handler)
|
||||
@@ -138,4 +140,3 @@ class Application:
|
||||
except Exception as e:
|
||||
self.logger.error(f"应用运行致命异常: {e}")
|
||||
self.logger.debug(f"Traceback: {traceback.format_exc()}")
|
||||
|
||||
|
||||
22
pkg/core/migrations/m014_force_delay_config.py
Normal file
22
pkg/core/migrations/m014_force_delay_config.py
Normal file
@@ -0,0 +1,22 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from .. import migration
|
||||
|
||||
|
||||
@migration.migration_class("force-delay-config", 14)
|
||||
class ForceDelayConfigMigration(migration.Migration):
|
||||
"""迁移"""
|
||||
|
||||
async def need_migrate(self) -> bool:
|
||||
"""判断当前环境是否需要运行此迁移"""
|
||||
return type(self.ap.platform_cfg.data['force-delay']) == list
|
||||
|
||||
async def run(self):
|
||||
"""执行迁移"""
|
||||
|
||||
self.ap.platform_cfg.data['force-delay'] = {
|
||||
"min": self.ap.platform_cfg.data['force-delay'][0],
|
||||
"max": self.ap.platform_cfg.data['force-delay'][1]
|
||||
}
|
||||
|
||||
await self.ap.platform_cfg.dump_config()
|
||||
@@ -27,7 +27,8 @@ class LoadConfigStage(stage.BootingStage):
|
||||
ap.settings_mgr.register_manager(
|
||||
name="command.json",
|
||||
description="命令配置",
|
||||
manager=ap.command_cfg
|
||||
manager=ap.command_cfg,
|
||||
schema=schema.CONFIG_COMMAND_SCHEMA
|
||||
)
|
||||
|
||||
ap.settings_mgr.register_manager(
|
||||
@@ -40,13 +41,15 @@ class LoadConfigStage(stage.BootingStage):
|
||||
ap.settings_mgr.register_manager(
|
||||
name="platform.json",
|
||||
description="消息平台配置",
|
||||
manager=ap.platform_cfg
|
||||
manager=ap.platform_cfg,
|
||||
schema=schema.CONFIG_PLATFORM_SCHEMA
|
||||
)
|
||||
|
||||
ap.settings_mgr.register_manager(
|
||||
name="provider.json",
|
||||
description="大模型能力配置",
|
||||
manager=ap.provider_cfg
|
||||
manager=ap.provider_cfg,
|
||||
schema=schema.CONFIG_PROVIDER_SCHEMA
|
||||
)
|
||||
|
||||
ap.settings_mgr.register_manager(
|
||||
|
||||
@@ -6,7 +6,7 @@ from .. import stage, app
|
||||
from .. import migration
|
||||
from ..migrations import m001_sensitive_word_migration, m002_openai_config_migration, m003_anthropic_requester_cfg_completion, m004_moonshot_cfg_completion
|
||||
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
|
||||
from ..migrations import m010_ollama_requester_config, m011_command_prefix_config, m012_runner_config, m013_http_api_config, m014_force_delay_config
|
||||
|
||||
|
||||
@stage.stage_class("MigrationStage")
|
||||
|
||||
Reference in New Issue
Block a user