perf(clover_yuc_wiki): 优化图片生成质量和异常处理- 将图片生成质量从50 调整为40,提高性能

(cherry picked from commit 31e898676e)
This commit is contained in:
SlyAimer 2025-03-18 16:04:38 +08:00
parent 67f6a13fe0
commit e637a2e92d
2 changed files with 4 additions and 3 deletions

View file

@ -112,7 +112,7 @@ async def get_yuc_wiki_image(template_name,width,height):
template_path=yuc_wiki_path,
template_name=f'{template_name}.html',
templates={"data": None},
quality=50,
quality=40,
type="jpeg",
pages={
"viewport": {"width": width, "height": height},

View file

@ -17,5 +17,6 @@ async def handle_function(message: MessageEvent):
await yuc_wiki.finish("暂无新番信息")
try:
await yuc_wiki.finish(MessageSegment.file_image(Path(yuc_wiki_image)))
except Exception:
await yuc_wiki.finish("新番信息被外星人抢走啦,请重试。这绝对不是咱的错,绝对不是!")
except Exception as e:
if not isinstance(e, nonebot.exception.FinishedException):
await yuc_wiki.finish("新番信息被外星人抢走啦,请重试。这绝对不是咱的错,绝对不是!")