37 lines
1.3 KiB
Markdown
37 lines
1.3 KiB
Markdown
---
|
||
name: long-image-download
|
||
description: 用 Playwright 将 MindSpace HTML 页面生成同名 PNG 长图,并返回可打开图片链接与附件下载链接
|
||
---
|
||
|
||
# 长图下载(Playwright)
|
||
|
||
## 何时使用
|
||
|
||
- 用户要求“长图下载”“保存长图”“页面图片格式”“整页 PNG”
|
||
- 已经或即将用 `static-page-publish` 生成 `public/*.html`
|
||
|
||
## 必须流程
|
||
|
||
1. 先确保 HTML 已经用 `write_file` / `edit_file` 写入 `public/<页面名>.html`
|
||
2. 调用 sandbox-fs 工具 `generate_long_image`:
|
||
|
||
```json
|
||
{
|
||
"html_path": "public/report.html",
|
||
"output_path": "public/report.long.png"
|
||
}
|
||
```
|
||
|
||
3. 用 `list_dir public` 确认 `<页面名>.long.png` 已存在
|
||
4. 回复用户时同时给:
|
||
- 页面链接:`[页面标题](.../public/report.html)`
|
||
- 长图预览链接:`[长图预览](.../public/report.long.png)`
|
||
- 长图下载链接:`[下载长图](.../public/report.html?download=long-image)`
|
||
|
||
## 规则
|
||
|
||
- `generate_long_image` 使用平台 Playwright,不要用 shell、自写截图脚本、`html2canvas` 或 `.thumbnail.svg` 冒充长图
|
||
- `.thumbnail.svg` 只是信息流封面,不是整页长图
|
||
- 长图文件名推荐与 HTML 同名:`report.html` -> `report.long.png`
|
||
- 没有确认 `.long.png` 已生成时,不要声称“长图已生成”
|