mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-08-09 12:40:59 +00:00
feat(platform): pass original image URL to Image component in 6 adapters (#2362)
Preserve the platform CDN URL in Image.url alongside base64 data, enabling plugins to use ContentElement.from_image_url() for direct vision API access without redundant local download. - aiocqhttp: use msg_data["data"]["url"] and msg.data["url"] - discord: use attachment.url - telegram: use file.file_path - slack: use pic_url - wecom: use picurl - qqofficial: use pic_url Satori adapter already follows this pattern (satori.py:168). The change is purely additive — base64 is preserved for backward compatibility, and get_bytes() priority (url → base64 → path) ensures plugins can choose the optimal path. Closes #2355 Co-authored-by: douxt <8429023+douxt@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -47,7 +47,7 @@ class SlackMessageConverter(abstract_platform_adapter.AbstractMessageConverter):
|
||||
yiri_msg_list.append(platform_message.Source(id=message_id, time=datetime.datetime.now()))
|
||||
if pic_url is not None:
|
||||
base64_url = await image.get_slack_image_to_base64(pic_url=pic_url, bot_token=bot.bot_token)
|
||||
yiri_msg_list.append(platform_message.Image(base64=base64_url))
|
||||
yiri_msg_list.append(platform_message.Image(url=pic_url, base64=base64_url))
|
||||
|
||||
yiri_msg_list.append(platform_message.Plain(text=message))
|
||||
chain = platform_message.MessageChain(yiri_msg_list)
|
||||
|
||||
Reference in New Issue
Block a user