mirror of
https://github.com/langbot-app/LangBot.git
synced 2025-11-25 19:37:36 +08:00
Fix/slack image (#1501)
* fix: dingtalk adapters couldn't handle images * fix: slack adapter couldn't put the image in logger
This commit is contained in:
@@ -204,7 +204,9 @@ async def get_slack_image_to_base64(pic_url: str, bot_token: str):
|
||||
try:
|
||||
async with aiohttp.ClientSession() as session:
|
||||
async with session.get(pic_url, headers=headers) as resp:
|
||||
image_data = await resp.read()
|
||||
return base64.b64encode(image_data).decode('utf-8')
|
||||
mime_type = resp.headers.get("Content-Type", "application/octet-stream")
|
||||
file_bytes = await resp.read()
|
||||
base64_str = base64.b64encode(file_bytes).decode("utf-8")
|
||||
return f"data:{mime_type};base64,{base64_str}"
|
||||
except Exception as e:
|
||||
raise (e)
|
||||
raise (e)
|
||||
Reference in New Issue
Block a user