feat(canvas): AI 拆图 - 完善规划、图层编辑与素材复用

This commit is contained in:
Codex committed 2026-10-09 18:02:18 +08:00
1 parent 09f9b8e902
commit 5707102fbc
56 files changed
+3541 -162

No files matched your search

Binary file not shown.
+2
View File
@@ -8,3 +8,5 @@
- `image-tools-layer-decomposition`:`bytedance/seedream-v5.0-pro/layer-decomposition`
两个 provider 都接受统一的 `images[]` 源图输入,结果 URL 会由宿主下载并持久化。
图层拆分固定请求 PNG,避免 JPEG 丢失透明通道。画布按数量、尺寸和非空内容验收输出,保留供应商实际返回的 alpha,不承诺 PNG 一定包含透明前景。结果保留接口返回顺序,可在画布中调整顺序与可见性;接口未声明语义名称和偏移时,不自动推断物体名称或裁切坐标。
@@ -24,7 +24,7 @@
"apiVersion": "yingce.plugin/v2",
"id": "image-tools",
"name": "Image Tools",
"version": "1.0.0",
"version": "1.0.1",
"author": "影策",
"description": "图片去背景与图层拆分工具协议插件。",
"permissions": [
@@ -245,7 +245,8 @@
"$omitEmpty": {
"$ref": "request.prompt"
}
}
},
"output_format": "png"
}
},
"poll": {
+4 -3
View File
@@ -2,7 +2,7 @@
"apiVersion": "yingce.plugin/v2",
"id": "image-tools",
"name": "Image Tools",
"version": "1.0.0",
"version": "1.0.1",
"author": "影策",
"description": "图片去背景与图层拆分工具协议插件。",
"permissions": [
@@ -19,7 +19,7 @@
}
]
},
"documentation": "# Image Tools\n\n影策图片工具协议插件,提供去背景和图层拆分两个异步能力。\n\n## 能力\n\n- `image-tools-remove-background`:`bria/remove-background`\n- `image-tools-layer-decomposition`:`bytedance/seedream-v5.0-pro/layer-decomposition`\n\n两个 provider 都接受统一的 `images[]` 源图输入,结果 URL 会由宿主下载并持久化。\n\n---\n\n# Image Tools Interface\n\n## Remove Background\n\n- Provider: `image-tools-remove-background`\n- Upstream: `POST /bria/remove-background`\n- Input: first image in `images[]`\n- Output: asynchronous image result\n\n## Layer Decomposition\n\n- Provider: `image-tools-layer-decomposition`\n- Upstream: `POST /bytedance/seedream-v5.0-pro/layer-decomposition`\n- Input: first image in `images[]`\n- Output: asynchronous image result list\n\n<!-- YINGCE_MANIFEST_CONTRACT_START -->\n## Manifest 完整接口定义\n\n以下 JSON 与插件包内实际 `manifest.json` 逐字段一致,覆盖插件身份、权限、配置、鉴权、参数、校验、创建、Agent、查询、取消、结果下载、响应和 Agent 响应映射。`documentation` 字段的值就是当前完整文档;为避免文档在自身内部无限递归,JSON 中仅用等义占位文本表示正文。\n\n```json\n{\n \"apiVersion\": \"yingce.plugin/v2\",\n \"id\": \"image-tools\",\n \"name\": \"Image Tools\",\n \"version\": \"1.0.0\",\n \"author\": \"影策\",\n \"description\": \"图片去背景与图层拆分工具协议插件。\",\n \"permissions\": [\n \"generation.run\",\n \"media.read\"\n ],\n \"configuration\": {\n \"fields\": [\n {\n \"name\": \"apiKey\",\n \"type\": \"secret\",\n \"label\": \"WaveSpeed API Key\",\n \"required\": true\n }\n ]\n },\n \"documentation\": \"<当前插件的完整 documentation,由 README.md 与 docs/interface.md 拼接而成;为避免 JSON 递归,此处不重复展开正文。>\",\n \"contributes\": {\n \"providers\": [\n {\n \"id\": \"image-tools-remove-background\",\n \"label\": \"Image Tools Remove Background\",\n \"capabilities\": [\n \"image\"\n ],\n \"scopes\": [\n \"admin.system-channel\",\n \"user.custom-channel\",\n \"canvas\",\n \"creation\",\n \"agent\"\n ],\n \"baseUrl\": \"https://api.wavespeed.ai/api/v3\",\n \"requiresPublicMediaUrls\": true,\n \"auth\": {\n \"type\": \"bearer\",\n \"field\": \"apiKey\"\n },\n \"parameters\": [\n {\n \"name\": \"model\",\n \"type\": \"string\",\n \"required\": false,\n \"mapping\": \"model\",\n \"description\": \"默认 bria/remove-background。\"\n },\n {\n \"name\": \"prompt\",\n \"type\": \"string\",\n \"required\": false,\n \"mapping\": \"prompt\",\n \"description\": \"可选工具提示词。\"\n },\n {\n \"name\": \"images\",\n \"type\": \"media[]\",\n \"required\": true,\n \"mapping\": \"source image\",\n \"description\": \"源图片。\"\n },\n {\n \"name\": \"providerOptions\",\n \"type\": \"object\",\n \"required\": false,\n \"mapping\": \"provider-specific fields\",\n \"description\": \"工具扩展字段。\"\n }\n ],\n \"create\": {\n \"method\": \"POST\",\n \"path\": \"/bria/remove-background\",\n \"contentType\": \"application/json\",\n \"body\": {\n \"image\": {\n \"$first\": {\n \"$map\": {\n \"from\": {\n \"$ref\": \"request.images\"\n },\n \"as\": \"media\",\n \"in\": {\n \"$ref\": \"media.value\"\n }\n }\n }\n },\n \"prompt\": {\n \"$omitEmpty\": {\n \"$ref\": \"request.prompt\"\n }\n },\n \"output_format\": {\n \"$coalesce\": [\n {\n \"$ref\": \"request.providerOptions.image-tools-remove-background.output_format\"\n },\n \"png\"\n ]\n }\n }\n },\n \"poll\": {\n \"method\": \"GET\",\n \"path\": \"/predictions/{{taskId}}/result\"\n },\n \"response\": {\n \"taskId\": {\n \"$coalesce\": [\n {\n \"$ref\": \"response.data.id\"\n },\n {\n \"$ref\": \"response.id\"\n }\n ]\n },\n \"status\": {\n \"$coalesce\": [\n {\n Line truncated
"documentation": "# Image Tools\n\n影策图片工具协议插件,提供去背景和图层拆分两个异步能力。\n\n## 能力\n\n- `image-tools-remove-background`:`bria/remove-background`\n- `image-tools-layer-decomposition`:`bytedance/seedream-v5.0-pro/layer-decomposition`\n\n两个 provider 都接受统一的 `images[]` 源图输入,结果 URL 会由宿主下载并持久化。\n\n图层拆分固定请求 PNG,避免 JPEG 丢失透明通道。画布按数量、尺寸和非空内容验收输出,保留供应商实际返回的 alpha,不承诺 PNG 一定包含透明前景。结果保留接口返回顺序,可在画布中调整顺序与可见性;接口未声明语义名称和偏移时,不自动推断物体名称或裁切坐标。\n\n---\n\n# Image Tools Interface\n\n## Remove Background\n\n- Provider: `image-tools-remove-background`\n- Upstream: `POST /bria/remove-background`\n- Input: first image in `images[]`\n- Output: asynchronous image result\n\n## Layer Decomposition\n\n- Provider: `image-tools-layer-decomposition`\n- Upstream: `POST /bytedance/seedream-v5.0-pro/layer-decomposition`\n- Input: first image in `images[]`\n- Output: asynchronous image result list\n\n<!-- YINGCE_MANIFEST_CONTRACT_START -->\n## Manifest 完整接口定义\n\n以下 JSON 与插件包内实际 `manifest.json` 逐字段一致,覆盖插件身份、权限、配置、鉴权、参数、校验、创建、Agent、查询、取消、结果下载、响应和 Agent 响应映射。`documentation` 字段的值就是当前完整文档;为避免文档在自身内部无限递归,JSON 中仅用等义占位文本表示正文。\n\n```json\n{\n \"apiVersion\": \"yingce.plugin/v2\",\n \"id\": \"image-tools\",\n \"name\": \"Image Tools\",\n \"version\": \"1.0.1\",\n \"author\": \"影策\",\n \"description\": \"图片去背景与图层拆分工具协议插件。\",\n \"permissions\": [\n \"generation.run\",\n \"media.read\"\n ],\n \"configuration\": {\n \"fields\": [\n {\n \"name\": \"apiKey\",\n \"type\": \"secret\",\n \"label\": \"WaveSpeed API Key\",\n \"required\": true\n }\n ]\n },\n \"documentation\": \"<当前插件的完整 documentation,由 README.md 与 docs/interface.md 拼接而成;为避免 JSON 递归,此处不重复展开正文。>\",\n \"contributes\": {\n \"providers\": [\n {\n \"id\": \"image-tools-remove-background\",\n \"label\": \"Image Tools Remove Background\",\n \"capabilities\": [\n \"image\"\n ],\n \"scopes\": [\n \"admin.system-channel\",\n \"user.custom-channel\",\n \"canvas\",\n \"creation\",\n \"agent\"\n ],\n \"baseUrl\": \"https://api.wavespeed.ai/api/v3\",\n \"requiresPublicMediaUrls\": true,\n \"auth\": {\n \"type\": \"bearer\",\n \"field\": \"apiKey\"\n },\n \"parameters\": [\n {\n \"name\": \"model\",\n \"type\": \"string\",\n \"required\": false,\n \"mapping\": \"model\",\n \"description\": \"默认 bria/remove-background。\"\n },\n {\n \"name\": \"prompt\",\n \"type\": \"string\",\n \"required\": false,\n \"mapping\": \"prompt\",\n \"description\": \"可选工具提示词。\"\n },\n {\n \"name\": \"images\",\n \"type\": \"media[]\",\n \"required\": true,\n \"mapping\": \"source image\",\n \"description\": \"源图片。\"\n },\n {\n \"name\": \"providerOptions\",\n \"type\": \"object\",\n \"required\": false,\n \"mapping\": \"provider-specific fields\",\n \"description\": \"工具扩展字段。\"\n }\n ],\n \"create\": {\n \"method\": \"POST\",\n \"path\": \"/bria/remove-background\",\n \"contentType\": \"application/json\",\n \"body\": {\n \"image\": {\n \"$first\": {\n \"$map\": {\n \"from\": {\n \"$ref\": \"request.images\"\n },\n \"as\": \"media\",\n \"in\": {\n \"$ref\": \"media.value\"\n }\n }\n }\n },\n \"prompt\": {\n \"$omitEmpty\": {\n \"$ref\": \"request.prompt\"\n }\n },\n \"output_format\": {\n \"$coalesce\": [\n {\n \"$ref\": \"request.providerOptions.image-tools-remove-background.output_format\"\n },\n \"png\"\n ]\n }\n }\n },\n \"poll\": {\n \"method\": \"GET\",\n \"path\": \"/predictions/{{taskId}}/rLine truncated
"contributes": {
"providers": [
{
@@ -223,7 +223,8 @@
"$omitEmpty": {
"$ref": "request.prompt"
}
}
},
"output_format": "png"
}
},
"poll": {