diff --git a/pkg/api/http/service/bot.py b/pkg/api/http/service/bot.py index a3987ba5..0bdb8e68 100644 --- a/pkg/api/http/service/bot.py +++ b/pkg/api/http/service/bot.py @@ -44,7 +44,17 @@ class BotService: if not include_secret: masked_columns = ['adapter_config'] - return self.ap.persistence_mgr.serialize_model(persistence_bot.Bot, bot, masked_columns) + adapter_runtime_values = {} + + runtime_bot = await self.ap.platform_mgr.get_bot_by_uuid(bot_uuid) + if runtime_bot is not None: + adapter_runtime_values['bot_account_id'] = runtime_bot.adapter.bot_account_id + + persistence_bot_data = self.ap.persistence_mgr.serialize_model(persistence_bot.Bot, bot, masked_columns) + + persistence_bot_data['adapter_runtime_values'] = adapter_runtime_values + + return persistence_bot_data async def create_bot(self, bot_data: dict) -> str: """创建机器人""" diff --git a/pkg/plugin/handler.py b/pkg/plugin/handler.py index 22cfe5c9..7441ae5c 100644 --- a/pkg/plugin/handler.py +++ b/pkg/plugin/handler.py @@ -187,6 +187,17 @@ class RuntimeConnectionHandler(handler.Handler): }, ) + @self.action(PluginToRuntimeAction.GET_BOT_INFO) + async def get_bot_info(data: dict[str, Any]) -> handler.ActionResponse: + """Get bot info""" + bot_uuid = data['bot_uuid'] + bot = await self.ap.bot_service.get_bot(bot_uuid, include_secret=False) + return handler.ActionResponse.success( + data={ + 'bot': bot, + }, + ) + @self.action(PluginToRuntimeAction.SEND_MESSAGE) async def send_message(data: dict[str, Any]) -> handler.ActionResponse: """Send message"""