feat(workbench): implement cleanup for history images to retain references after asset deletion

This commit is contained in:
HouYunFei
2026-08-06 15:21:59 +08:00
parent ca47eb6aaa
commit a4074f7413
4 changed files with 13 additions and 0 deletions
+1
View File
@@ -2,6 +2,7 @@
## Unreleased
+ [修复] 本地图片清理时保留生图与视频工作台历史引用的文件,避免生成记录仍在但图片丢失。
+ [修复] 画布将空格键专用于临时切换工具,避免按钮保留焦点后按空格被再次触发。
+ [优化] 画布默认改为拖动轻量虚线框选,虚线显示不受画布缩放影响,左下工具可切换选择与移动模式,并支持按住 Control 或空格临时反转当前模式。
+ [优化] 画布多图生成结果合并为单个图片节点,生成期间可展开查看每张图片的实时状态,优先展示最先成功的结果,并以紧凑堆叠展示已有图片。
@@ -21,6 +21,7 @@ The current release needs manual verification in these areas:
- Agent header tabs in English and Chinese at different panel widths; labels should collapse to icons and counts before either edge is clipped.
- Agent message layout, Markdown, code blocks, attachments, token statistics, progress timelines, command groups, and scroll-follow behavior.
- Prompt Center layout, source synchronization, search, asset insertion, prompt detail dialogs, and compact split-layout prompt pickers in the image and video workbenches.
- Workbench history image cleanup: after generating content in the image or video workbench, deleting an asset, canvas image node, canvas content, or canvas project must not remove thumbnails, results, or references from generation history; deleting a generation record should still remove its dedicated local files.
- Settings import/export, Volcengine Ark protocol handling, and WebDAV-related configuration.
The Chinese version contains the complete item-by-item acceptance checklist.
@@ -44,6 +44,7 @@ description: 当前版本已实现但仍需人工验证的变更项
- Agent 工作目录指令:`canvas-agent/agent-instructions.md` 应作为独立维护源;重启 Canvas Agent 后,当前工作目录应自动生成 `AGENTS.md`;新建对话发送消息时,Codex 日志中的用户消息只包含本轮请求和必要的附件上下文,不再重复整段 Infinite Canvas 前置提示词,画布及工作台工具仍可正常调用。
- 画布文本设置:文本节点和生成配置节点切换到文本模式后应显示推理强度设置,可选择自动、低、中、高、极高;选择自动时默认 OpenAI Responses 请求不应携带 `reasoning`,选择其他档位时应携带所选强度,刷新画布后节点设置应保留;文本模型自定义调用脚本应能读取 `reasoningEffort`OpenAI 模板应按自动或指定档位正确组装请求。
- 生图工作台参考图:将一张或多张图片拖入参考图区域后应直接上传并显示缩略图;拖入非图片文件应忽略,拖动过程中区域应显示高亮提示,放下文件不应导致浏览器打开或替换当前页面。
- 工作台历史图片清理:生图或视频工作台生成内容后,在「我的素材」删除图片、删除画布图片节点、清空画布或删除画布,再次打开对应生成记录时,历史缩略图、结果图片和参考图仍应正常显示;删除生成记录时,其专属本地文件仍应正常清理。
- 视频创作台参考资产:将图片、MP4/MOV 视频或 MP3/WAV 音频拖入任一参考资产区域后,应按文件类型自动上传到对应列表;当前拖入区域应显示高亮提示,原有数量、大小、时长和格式限制应继续生效。
- 画布组装提示词:输入或连接超长提示词后,浮层正文高度不应继续撑大,内容应可在正文区域内滚动查看和编辑,标题及关闭按钮保持可见。
- 画布节点提示词:图片等节点下方的提示词超过输入区域高度后,鼠标悬停在输入区域内滚动应查看提示词内容,不应缩放画布。
+10
View File
@@ -14,6 +14,8 @@ export type UploadedImage = {
};
const store = localforage.createInstance({ name: "infinite-canvas", storeName: "image_files" });
const imageLogStore = localforage.createInstance({ name: "infinite-canvas", storeName: "image_generation_logs" });
const videoLogStore = localforage.createInstance({ name: "infinite-canvas", storeName: "video_generation_logs" });
const objectUrls = new Map<string, string>();
export async function uploadImage(input: string | Blob): Promise<UploadedImage> {
@@ -67,6 +69,14 @@ export async function deleteStoredImages(keys: Iterable<string>) {
export async function cleanupUnusedImages(usedData: unknown) {
const usedKeys = collectImageStorageKeys(usedData);
await Promise.all([
imageLogStore.iterate((value) => {
collectImageStorageKeys(value, usedKeys);
}),
videoLogStore.iterate((value) => {
collectImageStorageKeys(value, usedKeys);
}),
]);
const unused: string[] = [];
await store.iterate((_value, key) => {
if (!usedKeys.has(key)) unused.push(key);