fix: migration bug of plugin config

This commit is contained in:
Junyan Qin
2025-09-16 17:04:44 +08:00
parent e7e6eeda61
commit 8bb2f3e745
4 changed files with 12 additions and 6 deletions
+7 -3
View File
@@ -14,10 +14,14 @@ class SystemRouterGroup(group.RouterGroup):
'version': constants.semantic_version, 'version': constants.semantic_version,
'debug': constants.debug_mode, 'debug': constants.debug_mode,
'enabled_platform_count': len(self.ap.platform_mgr.get_running_adapters()), 'enabled_platform_count': len(self.ap.platform_mgr.get_running_adapters()),
'enable_marketplace': self.ap.instance_config.data['plugin'].get('enable_marketplace', True), 'enable_marketplace': self.ap.instance_config.data.get('plugin', {}).get(
'enable_marketplace', True
),
'cloud_service_url': ( 'cloud_service_url': (
self.ap.instance_config.data['plugin']['cloud_service_url'] self.ap.instance_config.data.get('plugin', {}).get(
if 'cloud_service_url' in self.ap.instance_config.data['plugin'] 'cloud_service_url', 'https://space.langbot.app'
)
if 'cloud_service_url' in self.ap.instance_config.data.get('plugin', {})
else 'https://space.langbot.app' else 'https://space.langbot.app'
), ),
} }
@@ -1,7 +1,7 @@
from .. import migration from .. import migration
@migration.migration_class(4) @migration.migration_class(8)
class DBMigratePluginConfig(migration.DBMigration): class DBMigratePluginConfig(migration.DBMigration):
"""插件配置""" """插件配置"""
+3 -1
View File
@@ -73,7 +73,9 @@ class PluginRuntimeConnector:
if platform.get_platform() == 'docker' or platform.use_websocket_to_connect_plugin_runtime(): # use websocket if platform.get_platform() == 'docker' or platform.use_websocket_to_connect_plugin_runtime(): # use websocket
self.ap.logger.info('use websocket to connect to plugin runtime') self.ap.logger.info('use websocket to connect to plugin runtime')
ws_url = self.ap.instance_config.data['plugin']['runtime_ws_url'] ws_url = self.ap.instance_config.data.get('plugin', {}).get(
'runtime_ws_url', 'ws://langbot_plugin_runtime:5400/control/ws'
)
async def make_connection_failed_callback(ctrl: ws_client_controller.WebSocketClientController) -> None: async def make_connection_failed_callback(ctrl: ws_client_controller.WebSocketClientController) -> None:
self.ap.logger.error('Failed to connect to plugin runtime, trying to reconnect...') self.ap.logger.error('Failed to connect to plugin runtime, trying to reconnect...')
+1 -1
View File
@@ -1,6 +1,6 @@
semantic_version = 'v4.3.0' semantic_version = 'v4.3.0'
required_database_version = 7 required_database_version = 8
"""Tag the version of the database schema, used to check if the database needs to be migrated""" """Tag the version of the database schema, used to check if the database needs to be migrated"""
debug_mode = False debug_mode = False