mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-09-16 14:57:15 +00:00
fix(4.11): align omni adapters and EventProcessor marketplace support
This commit is contained in:
@@ -149,9 +149,9 @@ async def run_probe(
|
||||
platform_message.Plain(text='Discord EBA live reply: text'),
|
||||
platform_message.Image(base64=base64.b64encode(PNG_1X1).decode()),
|
||||
platform_message.File(
|
||||
name='discord-eba-live.txt',
|
||||
name='discord-omni-live.txt',
|
||||
size=16,
|
||||
base64='data:text/plain;base64,' + base64.b64encode(b'discord-eba-live').decode(),
|
||||
base64='data:text/plain;base64,' + base64.b64encode(b'discord-omni-live').decode(),
|
||||
),
|
||||
]
|
||||
),
|
||||
@@ -252,7 +252,7 @@ async def run_probe(
|
||||
await run_expected_error(
|
||||
api_results,
|
||||
'upload_file:not_supported',
|
||||
lambda: adapter.upload_file(b'discord-eba-upload', 'discord-eba-upload.txt'),
|
||||
lambda: adapter.upload_file(b'discord-omni-upload', 'discord-omni-upload.txt'),
|
||||
platform_errors.NotSupportedError,
|
||||
)
|
||||
await run_api(api_results, 'get_file_url', lambda: adapter.get_file_url('https://cdn.discordapp.com/file.txt'))
|
||||
|
||||
@@ -16,8 +16,7 @@ from langbot_plugin.api.entities.builtin.platform import message as platform_mes
|
||||
|
||||
|
||||
TINY_PNG = (
|
||||
'data:image/png;base64,'
|
||||
'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+/p9sAAAAASUVORK5CYII='
|
||||
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+/p9sAAAAASUVORK5CYII='
|
||||
)
|
||||
|
||||
|
||||
@@ -178,7 +177,11 @@ async def run_probe(args: argparse.Namespace):
|
||||
)
|
||||
await run_api(api_results, 'get_user_info', lambda: adapter.get_user_info(source.sender.id))
|
||||
await run_api(api_results, 'get_friend_list', lambda: adapter.get_friend_list())
|
||||
await run_api(api_results, 'call_platform_api:check_access_token', lambda: adapter.call_platform_api('check_access_token', {}))
|
||||
await run_api(
|
||||
api_results,
|
||||
'call_platform_api:check_access_token',
|
||||
lambda: adapter.call_platform_api('check_access_token', {}),
|
||||
)
|
||||
await run_api(
|
||||
api_results,
|
||||
'call_platform_api:get_user_info',
|
||||
@@ -203,7 +206,7 @@ def main():
|
||||
parser.add_argument('--port', type=int, default=5312)
|
||||
parser.add_argument('--path', default='/wecom/callback')
|
||||
parser.add_argument('--timeout', type=int, default=180)
|
||||
parser.add_argument('--bot-uuid', default='wecom-eba-live-probe')
|
||||
parser.add_argument('--bot-uuid', default='wecom-omni-live-probe')
|
||||
parser.add_argument('--log', default='data/temp/wecom_eba_live_probe.jsonl')
|
||||
parser.add_argument('--skip-api', action='store_true')
|
||||
args = parser.parse_args()
|
||||
|
||||
@@ -32,7 +32,9 @@ class ProbeLogger(AbstractEventLogger):
|
||||
def redact(value: Any) -> Any:
|
||||
if isinstance(value, dict):
|
||||
return {
|
||||
key: '<redacted>' if key.lower() in {'secret', 'token', 'encodingaeskey', 'encrypt', 'aeskey'} else redact(item)
|
||||
key: '<redacted>'
|
||||
if key.lower() in {'secret', 'token', 'encodingaeskey', 'encrypt', 'aeskey'}
|
||||
else redact(item)
|
||||
for key, item in value.items()
|
||||
}
|
||||
if isinstance(value, list):
|
||||
@@ -157,12 +159,22 @@ async def run_probe(args: argparse.Namespace):
|
||||
platform_message.MessageChain([platform_message.Plain(text='WeComBot EBA probe send')]),
|
||||
),
|
||||
)
|
||||
await run_api(api_results, 'get_message', lambda: adapter.get_message(source.chat_type.value, source.chat_id, source.message_id))
|
||||
await run_api(
|
||||
api_results,
|
||||
'get_message',
|
||||
lambda: adapter.get_message(source.chat_type.value, source.chat_id, source.message_id),
|
||||
)
|
||||
await run_api(api_results, 'get_user_info', lambda: adapter.get_user_info(source.sender.id))
|
||||
if source.group:
|
||||
await run_api(api_results, 'get_group_info', lambda: adapter.get_group_info(source.group.id))
|
||||
await run_api(api_results, 'get_group_member_list', lambda: adapter.get_group_member_list(source.group.id))
|
||||
await run_api(api_results, 'call_platform_api:is_websocket_mode', lambda: adapter.call_platform_api('is_websocket_mode', {}))
|
||||
await run_api(
|
||||
api_results, 'get_group_member_list', lambda: adapter.get_group_member_list(source.group.id)
|
||||
)
|
||||
await run_api(
|
||||
api_results,
|
||||
'call_platform_api:is_websocket_mode',
|
||||
lambda: adapter.call_platform_api('is_websocket_mode', {}),
|
||||
)
|
||||
await run_api(
|
||||
api_results,
|
||||
'call_platform_api:get_stream_session_status',
|
||||
@@ -187,12 +199,14 @@ async def run_probe(args: argparse.Namespace):
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description='Live WeComBot EBA adapter probe.')
|
||||
parser.add_argument('--webhook', action='store_true', help='Use webhook mode. Default is WebSocket long connection mode.')
|
||||
parser.add_argument(
|
||||
'--webhook', action='store_true', help='Use webhook mode. Default is WebSocket long connection mode.'
|
||||
)
|
||||
parser.add_argument('--host', default='0.0.0.0')
|
||||
parser.add_argument('--port', type=int, default=5313)
|
||||
parser.add_argument('--path', default='/wecombot/callback')
|
||||
parser.add_argument('--timeout', type=int, default=180)
|
||||
parser.add_argument('--bot-uuid', default='wecombot-eba-live-probe')
|
||||
parser.add_argument('--bot-uuid', default='wecombot-omni-live-probe')
|
||||
parser.add_argument('--log', default='data/temp/wecombot_eba_live_probe.jsonl')
|
||||
parser.add_argument('--skip-api', action='store_true')
|
||||
args = parser.parse_args()
|
||||
|
||||
@@ -16,8 +16,7 @@ from langbot_plugin.api.entities.builtin.platform import message as platform_mes
|
||||
|
||||
|
||||
TINY_PNG = (
|
||||
'data:image/png;base64,'
|
||||
'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+/p9sAAAAASUVORK5CYII='
|
||||
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+/p9sAAAAASUVORK5CYII='
|
||||
)
|
||||
|
||||
|
||||
@@ -168,7 +167,9 @@ async def run_probe(args: argparse.Namespace):
|
||||
),
|
||||
),
|
||||
)
|
||||
await run_api(api_results, 'get_message', lambda: adapter.get_message('private', source.chat_id, source.message_id))
|
||||
await run_api(
|
||||
api_results, 'get_message', lambda: adapter.get_message('private', source.chat_id, source.message_id)
|
||||
)
|
||||
await run_api(api_results, 'get_user_info', lambda: adapter.get_user_info(source.sender.id))
|
||||
await run_api(api_results, 'get_friend_list', lambda: adapter.get_friend_list())
|
||||
await run_api(
|
||||
@@ -200,7 +201,7 @@ def main():
|
||||
parser.add_argument('--port', type=int, default=5313)
|
||||
parser.add_argument('--path', default='/wecomcs/callback')
|
||||
parser.add_argument('--timeout', type=int, default=180)
|
||||
parser.add_argument('--bot-uuid', default='wecomcs-eba-live-probe')
|
||||
parser.add_argument('--bot-uuid', default='wecomcs-omni-live-probe')
|
||||
parser.add_argument('--log', default='data/temp/wecomcs_eba_live_probe.jsonl')
|
||||
parser.add_argument('--skip-api', action='store_true')
|
||||
args = parser.parse_args()
|
||||
|
||||
Reference in New Issue
Block a user