feat(image): integrate PoloX image editing workflows

Add WaveSpeed image editing and image tools plugins, canvas image editing workflows, layer selection, and Cloud Agent image tools with approval-safe transient references.
This commit is contained in:
Codex committed 2026-09-18 20:34:28 +08:00
1 parent 69456db2d5
commit 6ee9d1dcb2
34 files changed
+2537 -75

No files matched your search

@@ -1,16 +1,21 @@
import type { ReactNode } from "react";
import { Brush, Camera, Copy, FileText, Globe2, Grid2x2, Lock, LockOpen, Maximize2, PencilLine, Crop, SlidersHorizontal, Smile, Sun, Upload, Scaling } from "lucide-react";
import { Brush, Camera, Copy, FileText, Globe2, Grid2x2, Layers3, Lock, LockOpen, Maximize2, PencilLine, Crop, SlidersHorizontal, Smile, Sun, Upload, Scaling, WandSparkles } from "lucide-react";
import type { CanvasNodeData } from "@/types/canvas";
import type { NodeToolbarGroup } from "@/lib/canvas/tool-registry";
type ImageNodeActionToolId = "copyPrompt" | "reversePrompt" | "replace" | "resize" | "annotation" | "maskEdit" | "emotion" | "portraitTexture" | "crop" | "split" | "upscale" | "superResolve" | "angle" | "lighting" | "panorama" | "view";
type ImageNodeActionToolId = "copyPrompt" | "reversePrompt" | "replace" | "resize" | "annotation" | "annotationEdit" | "textEdit" | "maskEdit" | "imageEdit" | "removeBackground" | "layerDecomposition" | "emotion" | "portraitTexture" | "crop" | "split" | "upscale" | "superResolve" | "angle" | "lighting" | "panorama" | "view";
type ImageToolHandlers = {
onUpload: (node: CanvasNodeData) => void;
onToggleFreeResize: (node: CanvasNodeData) => void;
onAnnotate: (node: CanvasNodeData) => void;
onAnnotationEdit: (node: CanvasNodeData) => void;
onTextEdit: (node: CanvasNodeData) => void;
onMaskEdit: (node: CanvasNodeData) => void;
onImageEdit: (node: CanvasNodeData) => void;
onRemoveBackground: (node: CanvasNodeData) => void;
onLayerDecomposition: (node: CanvasNodeData) => void;
onEmotion: (node: CanvasNodeData) => void;
onPortraitTexture: (node: CanvasNodeData) => void;
onCrop: (node: CanvasNodeData) => void;
@@ -84,6 +89,16 @@ const imageToolDefinitions: ImageToolDefinition[] = [
order: 40,
run: (node, handlers) => handlers.onAnnotate(node),
},
{
id: "annotationEdit",
section: "拆分与标记",
description: "用画笔标记区域并让模型按标记修改",
label: "标注编辑",
icon: () => <Brush className="size-3.5" />,
group: "process",
order: 45,
run: (node, handlers) => handlers.onAnnotationEdit(node),
},
{
id: "maskEdit",
label: "局部重绘",
@@ -93,6 +108,42 @@ const imageToolDefinitions: ImageToolDefinition[] = [
order: 10,
run: (node, handlers) => handlers.onMaskEdit(node),
},
{
id: "textEdit",
label: "文字编辑",
description: "识别图片中的文字并逐行修改",
icon: () => <FileText className="size-3.5" />,
group: "primary",
order: 15,
run: (node, handlers) => handlers.onTextEdit(node),
},
{
id: "imageEdit",
label: "图片编辑",
description: "用文字描述要修改的内容,生成新图片",
icon: () => <WandSparkles className="size-3.5" />,
group: "primary",
order: 20,
run: (node, handlers) => handlers.onImageEdit(node),
},
{
id: "removeBackground",
label: "去除背景",
description: "保留主体并生成透明背景图片",
icon: () => <WandSparkles className="size-3.5" />,
group: "process",
order: 50,
run: (node, handlers) => handlers.onRemoveBackground(node),
},
{
id: "layerDecomposition",
label: "AI 图层拆分",
description: "识别并拆分为多个可独立编辑的图片图层",
icon: () => <Layers3 className="size-3.5" />,
group: "process",
order: 55,
run: (node, handlers) => handlers.onLayerDecomposition(node),
},
{
id: "emotion",
label: "表情调整",