From c6f037a947e324b96dc7df7d4ede1757a1b08919 Mon Sep 17 00:00:00 2001 From: baby-2016 <2185823427@qq.com> Date: Sat, 28 Feb 2026 21:17:43 +0800 Subject: [PATCH] =?UTF-8?q?feat(plugins):=20=E8=B0=83=E6=95=B4=E5=A4=A9?= =?UTF-8?q?=E6=B0=94=E5=9B=BE=E7=89=87=E6=B8=B2=E6=9F=93=E5=B0=BA=E5=AF=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/managers/image_manager.py | 4 ++-- plugins/weather.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/managers/image_manager.py b/core/managers/image_manager.py index 3d92944..cb557d9 100644 --- a/core/managers/image_manager.py +++ b/core/managers/image_manager.py @@ -112,11 +112,11 @@ class ImageManager(Singleton): logger.exception(f"渲染模板 {template_name} 失败: {e}") return None - async def render_template_to_base64(self, template_name: str, data: Dict[str, Any], output_name: str = "output.png", quality: int = 80, image_type: str = "png") -> Optional[str]: + async def render_template_to_base64(self, template_name: str, data: Dict[str, Any], output_name: str = "output.png", quality: int = 80, image_type: str = "png", width: int = 1920, height: int = 1080) -> Optional[str]: """ 渲染模板并返回 Base64 编码的图片字符串 """ - file_path = await self.render_template(template_name, data, output_name, quality, image_type) + file_path = await self.render_template(template_name, data, output_name, quality, image_type, width=width, height=height) if not file_path: return None diff --git a/plugins/weather.py b/plugins/weather.py index 950ed73..445b1f6 100644 --- a/plugins/weather.py +++ b/plugins/weather.py @@ -186,7 +186,7 @@ async def handle_weather(bot, event: MessageEvent, args: List[str]): try: # 渲染HTML模板为图片 base64_image = await image_manager.render_template_to_base64( - "weather.html", weather_info, output_name="weather.png" + "weather.html", weather_info, output_name="weather.png", width=1080 ) if base64_image: