diff --git a/docs/architecture/assets/workspace-modes/canvas-mode.png b/docs/architecture/assets/workspace-modes/canvas-mode.png index 58ddc32d8..a3a99f999 100644 Binary files a/docs/architecture/assets/workspace-modes/canvas-mode.png and b/docs/architecture/assets/workspace-modes/canvas-mode.png differ diff --git a/docs/architecture/assets/workspace-modes/empty-canvas-390-after-en-US.png b/docs/architecture/assets/workspace-modes/empty-canvas-390-after-en-US.png new file mode 100644 index 000000000..8d1a3ece3 Binary files /dev/null and b/docs/architecture/assets/workspace-modes/empty-canvas-390-after-en-US.png differ diff --git a/docs/architecture/assets/workspace-modes/empty-canvas-390-after-zh-CN.png b/docs/architecture/assets/workspace-modes/empty-canvas-390-after-zh-CN.png new file mode 100644 index 000000000..f5a45ad0d Binary files /dev/null and b/docs/architecture/assets/workspace-modes/empty-canvas-390-after-zh-CN.png differ diff --git a/docs/architecture/assets/workspace-modes/empty-canvas-390-before-en-US.png b/docs/architecture/assets/workspace-modes/empty-canvas-390-before-en-US.png new file mode 100644 index 000000000..6893fc488 Binary files /dev/null and b/docs/architecture/assets/workspace-modes/empty-canvas-390-before-en-US.png differ diff --git a/docs/architecture/assets/workspace-modes/empty-canvas-390-before-zh-CN.png b/docs/architecture/assets/workspace-modes/empty-canvas-390-before-zh-CN.png new file mode 100644 index 000000000..e083aa04d Binary files /dev/null and b/docs/architecture/assets/workspace-modes/empty-canvas-390-before-zh-CN.png differ diff --git a/docs/architecture/assets/workspace-modes/floating-chat.png b/docs/architecture/assets/workspace-modes/floating-chat.png index f6b1718e4..22678b8ee 100644 Binary files a/docs/architecture/assets/workspace-modes/floating-chat.png and b/docs/architecture/assets/workspace-modes/floating-chat.png differ diff --git a/docs/architecture/assets/workspace-modes/right-dock.png b/docs/architecture/assets/workspace-modes/right-dock.png index f70dd7260..bd1e96e5b 100644 Binary files a/docs/architecture/assets/workspace-modes/right-dock.png and b/docs/architecture/assets/workspace-modes/right-dock.png differ diff --git a/docs/architecture/workspace-modes-rfc.zh-CN.md b/docs/architecture/workspace-modes-rfc.zh-CN.md index 85321169a..e27428083 100644 --- a/docs/architecture/workspace-modes-rfc.zh-CN.md +++ b/docs/architecture/workspace-modes-rfc.zh-CN.md @@ -2,7 +2,7 @@ 本提案对应 [#373](https://github.com/ThinkFlowLab/OpenDirector/issues/373) 第 5 项,由 @congw729 于 2026-11-17 提出。[RFC 讨论 #386](https://github.com/ThinkFlowLab/OpenDirector/issues/386) -2026-11-30 修订。两种创作方式称为“对话创作”和“画布创作”,顶栏简称“对话”和“画布”。首个 PR 保留项目内多会话,统一从聊天标题栏打开会话历史。具体操作见[使用指南](../guides/user-guide.zh-CN.md)。 +2026-12-02 修订。两种创作方式称为“对话创作”和“画布创作”,顶栏简称“对话”和“画布”。首个 PR 保留项目内多会话,统一从聊天标题栏打开会话历史。具体操作见[使用指南](../guides/user-guide.zh-CN.md)。 两种创作方式共用同一项目和会话。用户可以在对话中委托 Agent、检查结果,也可以随时打开画布继续编辑。 @@ -13,14 +13,14 @@ 这次改动主要有三点: - **对话创作**以会话和结果为主,消息与输入区占据主工作区。 -- **画布创作**默认左侧聊天、右侧画布,按 1:2 分栏。用户可以将聊天固定到右侧、收起聊天或浮在画布上。 +- **画布创作**在宽屏上默认将聊天停靠到右侧,聊天约占三分之一,画布约占三分之二。用户可以将聊天停靠到左侧、收起或浮在画布上。浏览器沿用已经保存的停靠侧和宽度。 - **随时切换**:两种模式打开同一项目、同一会话。切换时保留草稿、引用、运行中的任务和编辑状态。 两种创作方式都支持深色和浅色主题。画布工具栏纵向排列,缩放、撤销等控件位于画布左下角。 ## 2. 工作区截图 -以下截图取自同一示例项目,分别展示整页对话、画布分栏和浮动聊天。画面使用仓库内的短片剧照,对话内容由测试替身提供。第 3 节列出从对话查看、编辑和导出结果的设计要求。 +以下截图分别展示整页对话、宽屏画布分栏、浮窗移动与停靠预览。第 3 节列出从对话查看、编辑和导出结果的设计要求。 ### 对话创作 @@ -36,15 +36,19 @@ ### 画布创作 -![画布创作默认分栏,左侧停靠聊天,右侧画布提供添加节点、资产库和上传入口](assets/workspace-modes/canvas-mode.png) +![宽屏画布默认将聊天停靠在右侧,画布工具栏直接显示各类节点按钮](assets/workspace-modes/canvas-mode.png) -宽屏默认按 **1:2** 停靠聊天。把聊天放在左侧,是为了让用户先看到 Agent 和当前对话,同时在右侧留出独立的画布编辑区。拖动分隔线或用左右方向键可以调整停靠宽度,双击分隔线可恢复默认比例。工具栏和底部控件相对画布定位。拖动聊天标题或点击“浮动聊天”可让聊天覆盖在画布上。对话创作顶栏的“在画布中浮动”可直接切到画布并浮起同一会话。浮窗可用鼠标拖动或通过键盘方向键移动。浮窗宽度根据停靠宽度和可用空间计算,高度随工作区适配。聊天标题栏用图标表示停靠方向,鼠标悬停或键盘聚焦时显示“停靠到左侧”或“停靠到右侧”。停靠时可切换到另一侧,浮动时可选择任一侧恢复分栏。浏览器记住停靠侧,切换时保留会话、分栏宽度和画布视口。 +宽屏第一次进入画布时,聊天默认停靠在右侧。浏览器已保存停靠侧或分栏宽度时,分别沿用对应的偏好。拖动分隔线或聚焦后按左右方向键可调整聊天宽度,双击分隔线可恢复默认宽度。聊天标题栏的停靠图标可以换边,悬停或用键盘聚焦时会提示目标侧。 -![点击“停靠到右侧”后,聊天固定在右侧,标题栏提供“停靠到左侧”以切回](assets/workspace-modes/right-dock.png) +对话创作使用整页聊天。点顶栏“在画布中浮动”会切到画布并浮起当前会话。在画布中也可拖动聊天标题或点击“浮动聊天”打开浮窗。拖住浮窗标题,把指针移到工作区左边缘或右边缘,就能看到该侧的停靠预览。在预览出现的位置松手,聊天才会停靠。移回中间后预览消失,在那里松手会保留浮窗。按 `Esc` 取消这次浮窗拖动。 -![同一会话浮动在画布右侧,左侧留出空间查看镜头素材](assets/workspace-modes/floating-chat.png) +使用键盘时,聚焦聊天标题后按方向键可移动浮窗,也可通过标题栏的停靠图标直接停靠到任一侧。浮窗宽度根据停靠宽度和可用空间计算,高度随工作区适配。移动和停靠保留会话、草稿和画布视口。 -画布左侧提供“添加节点”“资产库”和“上传”三个带文字的入口。“添加节点”展开文本、图片、视频、音频、时间线和主体六种类型。空画布中央的“浏览示例画布”打开示例列表,导入时会单独打开一个项目。 +![拖动浮窗标题到工作区右边缘时,预览标出松手后聊天的停靠位置](assets/workspace-modes/right-dock.png) + +![聊天浮在画布上,保持当前会话和输入区可见](assets/workspace-modes/floating-chat.png) + +画布工具栏分别显示文本、图片、视频、音频、时间线和主体按钮。选择一个按钮即可创建对应节点。“资产库”用于选取已有素材,“上传”用于导入本地文件。要在指定位置创建节点,可双击画布空白处再选择类型。空画布中央的“浏览示例画布”打开示例列表,导入时会单独打开一个项目。 画布创作保留连线、媒体编辑、历史版本和导出入口。用户可从时间线节点打开编辑器。在对话创作中,项目素材入口和对应的时间线结果也应能直接打开同一个编辑器,关闭后继续原会话。 @@ -148,7 +152,7 @@ flowchart LR - 画布缩放、适应视图和最小地图使用新的容器尺寸,切换模式不自动重排节点或保存一份错误视口。 - 对话创作里的对话不能被“折叠聊天”关成空白页;现有双 Shift 快捷键在这个模式里建议改为聚焦输入框。 -**1:2 是默认停靠比例。** 拖动分隔线可调整宽度,双击恢复默认。收起聊天后,画布占满工作区。可用宽度不超过 700px 时,一次显示聊天或画布,保留项目和模式入口。窗口再次变宽时恢复之前的停靠或浮动布局。 +**聊天与画布的默认宽度比约为 1:2。** 拖动分隔线可调整宽度,双击恢复默认。收起聊天后,画布占满工作区。可用宽度不超过 700px 时,一次显示聊天或画布,保留项目和模式入口。窗口再次变宽时恢复之前的停靠或浮动布局。 ## 6. 模型配置、任务与结果的规则 @@ -234,7 +238,9 @@ flowchart TB | 编辑器有草稿、保存失败或版本冲突时切换 | 草稿、版本基线和错误保留,后续仍能正确保存或重试 | | 时间轴播放、浏览器渲染、待发布阶段切换 | 播放头、输出任务和产物保留;发布冲突按原规则处理 | | 隐藏画布再打开、拖动分栏、在聊天中输入快捷键 | 节点位置与视口正确,菜单可用,聊天操作不误触画布 | -| 从对话打开浮窗、移动、左右停靠、缩窄后恢复窗口 | 会话与草稿连续,移动浮窗保持视口,定位目标可见,窄窗口的聊天和画布均可访问 | +| 拖动聊天浮窗、换边停靠、缩窄后恢复窗口 | 拖至左右边缘能预览,松手停靠到对应侧。移出预览后松手或取消浮窗拖动,聊天保持浮动。保留草稿和视口,窄屏仍可访问聊天和画布 | +| 宽屏首次停靠、恢复已有偏好 | 无停靠侧偏好时聊天在右侧,已保存的左侧或右侧及宽度在刷新后恢复 | +| 从画布工具栏创建节点 | 六种节点各有独立按钮,可用指针或键盘直接创建;资产库和上传仍可打开 | | 从对话创作定位结果,再回到对话 | 使用同一资产和版本,不复制项目;已有编辑继续可见 | | 无模型、只有语言模型、外部 Agent runtime | 首次引导要求可用的语言模型;已进入的工作区按操作检查所需能力,导入和本地编辑可继续使用 | | 做完一段视频,保存并重新打开项目 | 时间轴与素材可继续编辑,下载的 MP4 实际可播放 | @@ -246,7 +252,7 @@ flowchart TB 模式切换沿用[界面性能预算](../development/ui-performance.md):首个反馈 P90 不超过 100ms,可操作中位数不超过 500ms、P90 不超过 1s。空项目、媒体较多的项目、第一次打开与已经加载过的切换分别测量。减少工具栏数量或工具调用次数,本身不能说明视频做得更快;需要观察用户是否更容易完成同一个任务。 -本节列出交付条件。各阶段实现和验证记录见 [PR #380](https://github.com/ThinkFlowLab/OpenDirector/pull/380)。 +对话与画布双模式的首版实现和验证记录见 [PR #380](https://github.com/ThinkFlowLab/OpenDirector/pull/380)。 ## 9. 与其他任务的边界 diff --git a/docs/guides/assets/canvas-chat-docking.mp4 b/docs/guides/assets/canvas-chat-docking.mp4 new file mode 100644 index 000000000..0086e9699 Binary files /dev/null and b/docs/guides/assets/canvas-chat-docking.mp4 differ diff --git a/docs/guides/user-guide.md b/docs/guides/user-guide.md index 08003dff7..50d76bde6 100644 --- a/docs/guides/user-guide.md +++ b/docs/guides/user-guide.md @@ -7,9 +7,12 @@ On first launch, select **Get started** and connect a language model or a ready local assistant. Choose **Create with chat** to start with an idea. You can open model settings during the conversation to add image, video, or audio models as needed. Choose **Create on canvas** to see the canvas starting options. Your first canvas requires one image or video generation model. An existing compatible model counts. You can then enter an empty canvas, start selected tasks, import media, or open an example. If you start in chat, you can complete this setup the first time you switch to the canvas. - In **Create with chat**, use the composer to describe a goal or attach a reference. Open **Conversation history** from the chat header to search and switch conversations in this project. Desktop chat also uses the full workspace. Switch projects from the top bar. Select **Float on canvas** to keep chatting while you edit. Press `Shift` twice to focus the composer. -- **Create on canvas** opens with chat on the left and the canvas on the right in a 1:2 split. Hover over the docking icon in the chat header or focus it with Tab to see which side it moves chat to. Select it to swap sides. On a wide screen, drag the chat title or select **Float chat** to position it over the canvas. Select either docking icon to return to split view on that side. +- In **Create on canvas**, chat starts docked on the right of a wide workspace, taking up about a third of its width. The browser restores any saved dock side and width. Hover over a docking icon in the chat header or focus it with `Tab` to see its destination, then activate it to switch sides. +- To float chat over the canvas, drag the chat title or select **Float chat**. Drag the floating title until the pointer reaches the left or right edge of the workspace. A preview shows where chat will dock when you release. Move away from the edge before releasing to keep chat floating, or press `Esc` to cancel the drag. You can also dock on either side using the icons in the chat header. - In a narrow window, **Canvas** shows one area at a time. Use **Show canvas** and **Chat with AI** to switch between them. +[Watch how to dock chat, create nodes, and reopen the project (MP4)](assets/canvas-chat-docking.mp4) + Both modes share the same project, conversation, draft and attachments. Switching modes preserves the canvas view and keeps replies and generation tasks running without submitting them again. You can switch modes while a reference is uploading. It will appear in the same conversation when the upload finishes. While cropping an image or editing a timeline, use **Chat** or **Canvas** in the editor header to switch and keep your unsaved edits. If an MP4 is rendering, leave the page open. You can switch modes and download or publish the finished video from the same editor. @@ -105,7 +108,7 @@ The first launch creates an untitled canvas. Later launches can restore the most - Click the project name at the top left to rename it. Press `Enter` or click elsewhere to save, or press `Esc` to cancel. - Click the arrow next to the name to switch projects. Choose **New canvas project** to create one. -- Choose **Add node** in the left toolbar, then pick text, image, video, audio, timeline, or subject. To place the node at a particular spot, double-click that spot on the empty canvas and choose its type. With the canvas focused, press `T` to add a text node directly. +- In the canvas toolbar, select **Text**, **Image**, **Video**, **Audio**, **Timeline**, or **Subject** to create that type of node in one step. To place it at a particular spot, double-click that spot on the empty canvas and choose its type. With the canvas focused, press `T` to add a text node directly. - To explore a complete project, select **Browse example canvases** on an empty canvas or **Example canvases** in the project menu. The list shows sample sizes and download progress, and offers manual download links where available. Importing a sample opens a new project. A ZIP containing one `.canvas` file is unpacked automatically. If a download returns a webpage, the picker reports the error. - To connect a generation model, open **Settings → Model connections**. - Right-click empty canvas space to create a node, paste, undo, or redo. diff --git a/docs/guides/user-guide.zh-CN.md b/docs/guides/user-guide.zh-CN.md index 24f6d7fe4..7beabe9c6 100644 --- a/docs/guides/user-guide.zh-CN.md +++ b/docs/guides/user-guide.zh-CN.md @@ -7,9 +7,12 @@ 首次打开时,点“开始设置”,配置语言模型或连接已就绪的本地助手。连接成功后,点“对话创作”就能从一个想法开始;需要生成图片、视频或音频时,可以在对话中打开设置添加模型。点击“画布创作”会打开画布的开始方式。首次进入需要至少一个图片或视频生成模型,已有可用配置会自动识别。之后可以进入空画布、开始所选任务、导入素材或打开示例。先用对话创作的用户,首次切到画布时也可以在提示中完成配置。 - 在**对话创作**底部的输入框描述创作目标,或添加参考素材。从聊天顶部打开“历史会话”可以搜索、切换当前项目的对话。桌面端在对话创作中也使用整页聊天,项目从顶栏切换。点击顶栏的“在画布中浮动”,就能边看画布边和助手继续聊。连按两次 `Shift` 可聚焦输入框。 -- **画布创作**默认左边聊天、右边画布,按 1:2 分栏。将鼠标移到聊天标题栏的停靠图标上,或用 Tab 键聚焦它,即可看到目标侧。点击图标可以换边。宽屏下,拖动聊天标题或点击“浮动聊天”可以让对话浮在画布上,再选择左侧或右侧停靠图标恢复分栏。 +- **画布创作**在宽屏上默认把聊天停靠在右侧,约占工作区宽度的三分之一。浏览器会恢复已保存的停靠侧和宽度。将鼠标移到聊天标题栏的停靠图标上,或用 `Tab` 聚焦它,可看到目标侧并切换过去。 +- 拖动聊天标题,或点击“浮动聊天”,可让对话浮在画布上。拖住浮窗标题,把指针移到工作区左边缘或右边缘,预览会标出停靠位置。松手即可停靠。想保持浮动,移出预览区再松手,或按 `Esc` 取消拖动。也可以直接用聊天标题栏的图标停靠到任一侧。 - 窗口较窄时,“画布”一次显示一个区域,通过“查看画布”和“与 AI 对话”切换。 +[观看浮动与停靠聊天、创建节点和重开项目的操作演示(MP4)](assets/canvas-chat-docking.mp4) + 两种模式共用当前项目、会话、输入草稿和附件。切换会保留画布视角,正在进行的回复和生成任务会继续,不会重新提交。 上传参考素材时也可以切换模式,上传完成后素材仍会出现在原对话里。裁剪图片或编辑时间线时,可以点编辑器标题栏的“对话”或“画布”切换,接着修改尚未保存的内容。渲染 MP4 期间请保持页面打开,切换模式后仍可在同一编辑器下载或发布成片。 @@ -105,7 +108,7 @@ vLLM-Omni 视频连接支持直接输入小数秒,例如 `6.583333`。CLI 可 - 点击左上角项目名称修改名称,按 `Enter` 或点击其他位置保存,按 `Esc` 取消。 - 点击名称右侧的箭头切换项目,选择“新建画布项目”创建项目。 -- 点击左侧的“添加节点”,再选择文本、图片、视频、音频、时间线或主体。要把节点放在指定位置,双击画布上的空白位置,再选类型。焦点在画布上时,按 `T` 可直接添加文本节点。 +- 画布工具栏直接显示文本、图片、视频、音频、时间线和主体按钮。点击对应按钮即可创建节点。要把节点放在指定位置,双击画布上的空白位置再选类型。焦点在画布上时,按 `T` 可直接添加文本节点。 - 想看看完整项目时,点击空画布上的“浏览示例画布”,或从项目菜单打开“示例画布”。列表会显示示例大小和下载进度,部分示例也提供手动下载链接。导入后会打开一个新项目。下载包中若只有一个 `.canvas` 文件,会自动解包。若下载返回网页,列表会提示错误。 - 要连接生成模型,打开“设置 → 模型接入”。 - 右键空白画布可新建节点、粘贴、撤销或重做。 diff --git a/src/canvas/CanvasCreationMenu.tsx b/src/canvas/CanvasCreationMenu.tsx index 14a5c71bb..52deba294 100644 --- a/src/canvas/CanvasCreationMenu.tsx +++ b/src/canvas/CanvasCreationMenu.tsx @@ -52,18 +52,14 @@ export function CreationMenuContent({ onUpload, onImportUrl, allowedKinds, - nodesOnly = false, }: CreationActions & { allowedKinds?: readonly CanvasNodeKind[]; - nodesOnly?: boolean; }) { const t = useT(); return ( <>
{t("canvas.menu.newNode")}
- {CANVAS_CREATION_TOOLS.filter( - (tool) => !nodesOnly || !tool.unavailable, - ).map((tool) => + {CANVAS_CREATION_TOOLS.map((tool) => tool.unavailable ? ( {t(tool.labelKey)} - {nodesOnly && tool.kind === "text" && ( - - )} ), )} - {!allowedKinds && !nodesOnly && ( + {!allowedKinds && ( <>
+ {nodeTools.map((tool, index) => ( + setTabStop(index)} + onClick={() => onCreate(tool.kind)} + > + + {t(tool.labelKey)} + + ))}