🐛 粗暴地修复httpx ssl问题

This commit is contained in:
Asankilp 2025-02-02 21:49:22 +08:00
parent 4b7aca71d1
commit 1308d6fea6
2 changed files with 4 additions and 1 deletions

View File

@ -268,6 +268,7 @@ async def marsho(
) # type: ignore ) # type: ignore
).as_dict() # type: ignore ).as_dict() # type: ignore
) # type: ignore ) # type: ignore
logger.info(f"输入图片 {i.data['url']}")
elif config.marshoai_enable_support_image_tip: elif config.marshoai_enable_support_image_tip:
await UniMessage( await UniMessage(
"*此模型不支持图片处理或管理员未启用此模型的图片支持。图片将被忽略。" "*此模型不支持图片处理或管理员未启用此模型的图片支持。图片将被忽略。"

View File

@ -96,7 +96,9 @@ async def get_image_b64(url: str, timeout: int = 10) -> Optional[str]:
return: 图片base64编码 return: 图片base64编码
""" """
if data_type := await get_image_raw_and_type(url, timeout): if data_type := await get_image_raw_and_type(
url.replace("https://", "http://"), timeout
):
# image_format = content_type.split("/")[1] if content_type else "jpeg" # image_format = content_type.split("/")[1] if content_type else "jpeg"
base64_image = base64.b64encode(data_type[0]).decode("utf-8") base64_image = base64.b64encode(data_type[0]).decode("utf-8")
data_url = "data:{};base64,{}".format(data_type[1], base64_image) data_url = "data:{};base64,{}".format(data_type[1], base64_image)