mirror of
https://github.com/Nezumi-2711/astrbot_plugin_qq_group_daily_analysis.git
synced 2026-09-22 13:38:43 +00:00
fix(PDFInstaller): 字体处理和友好提示
This commit is contained in:
@@ -455,8 +455,9 @@ class ReportGenerator:
|
||||
except Exception:
|
||||
logger.warning("等待页面加载超时,继续执行")
|
||||
|
||||
# 减少等待时间,避免内存累积
|
||||
await asyncio.sleep(1)
|
||||
# 确保CDN字体等资源加载完成
|
||||
logger.info("等待资源加载(10s)...")
|
||||
await asyncio.sleep(10)
|
||||
|
||||
# 导出 PDF,使用更保守的设置
|
||||
logger.info("开始生成PDF...")
|
||||
|
||||
@@ -169,6 +169,11 @@ class PDFInstaller:
|
||||
"lsb-release",
|
||||
"wget",
|
||||
"xdg-utils",
|
||||
# Chinese Fonts
|
||||
"fonts-noto-cjk",
|
||||
"fonts-wqy-zenhei",
|
||||
# Emoji Fonts
|
||||
"fonts-noto-color-emoji",
|
||||
]
|
||||
|
||||
# 使用 shell=True 来执行连接命令,但在 asyncio 中通常使用 shell wrap
|
||||
@@ -226,12 +231,14 @@ class PDFInstaller:
|
||||
PDFInstaller._download_status["completed"] = True
|
||||
PDFInstaller._download_status["failed"] = False
|
||||
logger.info("✅ Chromium 后台下载完成!")
|
||||
return "✅ Chromium 后台下载完成!"
|
||||
else:
|
||||
PDFInstaller._download_status["failed"] = True
|
||||
PDFInstaller._download_status["error_message"] = (
|
||||
"下载失败,请检查网络连接"
|
||||
)
|
||||
logger.error("❌ Chromium 下载失败")
|
||||
return "❌ Chromium 下载失败"
|
||||
|
||||
except asyncio.TimeoutError:
|
||||
PDFInstaller._download_status["failed"] = True
|
||||
@@ -239,11 +246,13 @@ class PDFInstaller:
|
||||
f"下载超时({timeout_seconds}秒)"
|
||||
)
|
||||
logger.error(f"❌ Chromium 下载超时({timeout_seconds}秒)")
|
||||
return f"❌ Chromium 下载超时({timeout_seconds}秒)"
|
||||
|
||||
except Exception as e:
|
||||
PDFInstaller._download_status["failed"] = True
|
||||
PDFInstaller._download_status["error_message"] = str(e)
|
||||
logger.error(f"后台下载 Chromium 时出错: {e}", exc_info=True)
|
||||
return f"❌ 后台下载 Chromium 时出错: {e}"
|
||||
finally:
|
||||
PDFInstaller._download_status["in_progress"] = False
|
||||
|
||||
|
||||
Reference in New Issue
Block a user