mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-08-24 11:07:14 +00:00
feat: change standalone runtime tag env
This commit is contained in:
@@ -51,7 +51,7 @@ class PluginRuntimeConnector:
|
|||||||
async def initialize(self):
|
async def initialize(self):
|
||||||
async def new_connection_callback(connection: base_connection.Connection):
|
async def new_connection_callback(connection: base_connection.Connection):
|
||||||
async def disconnect_callback(rchandler: handler.RuntimeConnectionHandler) -> bool:
|
async def disconnect_callback(rchandler: handler.RuntimeConnectionHandler) -> bool:
|
||||||
if platform.get_platform() == 'docker':
|
if platform.get_platform() == 'docker' or platform.use_websocket_to_connect_plugin_runtime():
|
||||||
self.ap.logger.error('Disconnected from plugin runtime, trying to reconnect...')
|
self.ap.logger.error('Disconnected from plugin runtime, trying to reconnect...')
|
||||||
await self.runtime_disconnect_callback(self)
|
await self.runtime_disconnect_callback(self)
|
||||||
return False
|
return False
|
||||||
@@ -69,7 +69,7 @@ class PluginRuntimeConnector:
|
|||||||
|
|
||||||
task: asyncio.Task | None = None
|
task: asyncio.Task | None = None
|
||||||
|
|
||||||
if platform.get_platform() == 'docker': # 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['plugin']['runtime_ws_url']
|
||||||
|
|
||||||
|
|||||||
@@ -12,3 +12,9 @@ def get_platform() -> str:
|
|||||||
return 'docker'
|
return 'docker'
|
||||||
|
|
||||||
return sys.platform
|
return sys.platform
|
||||||
|
|
||||||
|
|
||||||
|
def use_websocket_to_connect_plugin_runtime() -> bool:
|
||||||
|
"""是否使用 websocket 连接插件运行时"""
|
||||||
|
STANDALONE_RUNTIME = os.environ.get('STANDALONE_RUNTIME', 'false')
|
||||||
|
return STANDALONE_RUNTIME == 'true'
|
||||||
|
|||||||
Reference in New Issue
Block a user