feat(*): 画布创作体验 - 完善 Agent 引导、生成防重、搜索快捷键、素材多选与分辨率兼容
This commit is contained in:
1 parent
089b49f881
commit
e99ddf3a81
52 files changed
+2344
-500
No files matched your search
@@ -25,7 +25,7 @@ func TestAutoDLPluginArtifact(t *testing.T) {
|
||||
t.Fatalf("loaded adapters = %d", len(adapters))
|
||||
}
|
||||
adapter := adapters[0]
|
||||
if adapter.Metadata().ID != "autodl-comfyui" || adapter.Metadata().Version != "1.0.1" || adapter.Metadata().Execution != "declarative" {
|
||||
if adapter.Metadata().ID != "autodl-comfyui" || adapter.Metadata().Version != "1.0.2" || adapter.Metadata().Execution != "declarative" {
|
||||
t.Fatalf("metadata = %#v", adapter.Metadata())
|
||||
}
|
||||
if !adapter.Metadata().RequiresPublicMediaURLs {
|
||||
@@ -33,7 +33,7 @@ func TestAutoDLPluginArtifact(t *testing.T) {
|
||||
}
|
||||
|
||||
create, err := adapter.BuildCreate(context.Background(), RequestContext{BaseURL: "https://autodl.art", Request: GenerationRequest{
|
||||
Model: "minimax_h3_lightx2v_no_pic", Prompt: "a cinematic test", Duration: 3, Resolution: "768", Images: []MediaReference{{URL: "https://cdn.example/reference.png"}},
|
||||
Model: "minimax_h3_lightx2v_no_pic", Prompt: "a cinematic test", Duration: 3, Resolution: "768P竖", Images: []MediaReference{{URL: "https://cdn.example/reference.png"}},
|
||||
}})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -42,7 +42,7 @@ func TestAutoDLPluginArtifact(t *testing.T) {
|
||||
t.Fatalf("create spec = %#v", create)
|
||||
}
|
||||
body, ok := create.Body.(map[string]any)
|
||||
if !ok || body["prompt"] != "a cinematic test" || body["duration"] != 3 || body["resolution"] != "768p" || body["ref_image_0"] != "https://cdn.example/reference.png" {
|
||||
if !ok || body["prompt"] != "a cinematic test" || body["duration"] != 3 || body["resolution"] != "768p竖" || body["ref_image_0"] != "https://cdn.example/reference.png" {
|
||||
t.Fatalf("create body = %#v", create.Body)
|
||||
}
|
||||
if _, exists := body["ref_image_1"]; exists {
|
||||
|
||||
@@ -365,19 +365,15 @@ func TestDeclarativeManifestSupportsMediaPathsTransformsAndErrors(t *testing.T)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDeclarativeManifestNormalizesVideoResolutionWithoutBreakingWorkflowValues(t *testing.T) {
|
||||
func TestDeclarativeManifestKeepsLegacyVideoResolutionTransformCompatible(t *testing.T) {
|
||||
tests := map[string]string{
|
||||
"768": "768p",
|
||||
"768p": "768p",
|
||||
"768P": "768p",
|
||||
" 768P ": "768p",
|
||||
"768p竖": "768p竖",
|
||||
"768P横": "768p横",
|
||||
"2K": "2k",
|
||||
"768": "768p",
|
||||
"768P": "768p",
|
||||
"768P横": "768p横",
|
||||
}
|
||||
for input, expected := range tests {
|
||||
if actual := applyManifestTransform(input, "video-resolution"); actual != expected {
|
||||
t.Errorf("video resolution transform %q = %#v, want %q", input, actual, expected)
|
||||
t.Errorf("legacy video resolution transform %q = %#v, want %q", input, actual, expected)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ AutoDL 的模型选择对应 ComfyUI 工作流 ID。不同工作流可以声明
|
||||
|
||||
## 参数
|
||||
|
||||
请求体为 JSON。常用字段包括 `prompt`、`duration` 和 `resolution`;实际工作流可以扩展自己的参数 schema。插件使用 `video-resolution` 字段变换:历史状态中的纯数字 `768` 会发送为 `768p`,已经带后缀的 `768p` 以及工作流值 `768p竖`、`768p横` 保持其语义。状态返回值位于 `data.status`,任务 ID 位于 `data.task_id`,成功结果位于 `data.results`。结果数组中的地址是短期 URL,成功后必须立即由宿主下载到影策资源存储,不能把临时地址直接写入画布长期数据。
|
||||
请求体为 JSON。常用字段包括 `prompt`、`duration` 和 `resolution`;实际工作流可以扩展自己的参数 schema。工作流声明的分辨率选项属于供应商枚举,画布必须保留其完整值,例如 `768p竖`、`768p横`,插件仅在发送前统一转换为小写,不在宿主中增加 AutoDL 专用归一化。状态返回值位于 `data.status`,任务 ID 位于 `data.task_id`,成功结果位于 `data.results`。结果数组中的地址是短期 URL,成功后必须立即由宿主下载到影策资源存储,不能把临时地址直接写入画布长期数据。
|
||||
|
||||
## 鉴权
|
||||
|
||||
|
||||
@@ -555,13 +555,15 @@ func applyManifestTransform(value any, transform string) any {
|
||||
case "upper", "uppercase":
|
||||
return strings.ToUpper(text)
|
||||
case "video-resolution", "video_resolution", "videoresolution":
|
||||
return normalizeManifestVideoResolution(text)
|
||||
// Compatibility for already-installed 1.0.1 manifests. New plugins
|
||||
// should declare exact enum values and use generic string transforms.
|
||||
return normalizeLegacyManifestVideoResolution(text)
|
||||
default:
|
||||
return value
|
||||
}
|
||||
}
|
||||
|
||||
func normalizeManifestVideoResolution(value string) string {
|
||||
func normalizeLegacyManifestVideoResolution(value string) string {
|
||||
normalized := strings.ToLower(strings.TrimSpace(value))
|
||||
if normalized == "" {
|
||||
return ""
|
||||
|
||||
Reference in new issue
Block a user