feat(agent): 批量创作表 - 注册节点能力与读写工具

This commit is contained in:
ddCat
2026-09-15 20:56:33 +08:00
parent c57f1b36ae
commit 9868f5e8b8
7 changed files with 815 additions and 3 deletions

View File

@@ -50,6 +50,34 @@ func BuiltinRegistry() *Registry {
return map[string]any{"frame": map[string]any{"collapsed": false, "expandedWidth": float64(760), "expandedHeight": float64(520)}}
},
},
{
Type: "batch-table", Version: "1", Label: "批量创作表", DefaultWidth: 900, DefaultHeight: 520,
Purpose: "面向电商批量换装和创意生图的结构化任务表;每行绑定最多六组画布图片、可用 @参考图1 等位置引用编写独立提示词,并追踪生成结果。",
GoodFor: []string{"商品与模特批量换装", "同一商品多场景创意图", "多组参考图组合生成", "批量结果追踪与失败重试"},
NotIdealFor: []string{"通用数据库或库存管理", "单张图片快速试验", "多镜头叙事连续性"},
Tradeoffs: []string{"参考图必须先作为图片节点进入画布", "批量提交会产生多项生成任务,执行前必须确认模型、数量和费用"},
Actions: []string{"read_rows", "append_row", "update_row", "remove_row", "set_operation", "set_concurrency", "add_reference_column", "preview_batch_generation"},
InputKind: "text",
Connection: ConnectionPolicy{CanSource: true, CanTarget: true, AcceptedInputKinds: []string{"image"}},
CanUpdate: true, SummaryFields: []string{"batchTable"}, DetailFields: []string{"batchTable"}, ProjectionKind: "batch_table", ProjectionField: "batchTable",
PatchFields: map[string]PatchField{
"title": {Path: "title", Kind: patchKindString, Label: "节点名称", Order: 10, Description: "批量创作表标题", MaxRunes: maxAgentNodeTitleRunes},
},
CreateMetadata: func(string) map[string]any {
return map[string]any{
"status": "idle",
"batchTable": map[string]any{
"operation": "try_on", "concurrency": float64(10),
"referenceColumns": []any{
map[string]any{"id": "reference-1", "label": "参考图 1"},
map[string]any{"id": "reference-2", "label": "参考图 2"},
map[string]any{"id": "reference-3", "label": "参考图 3"},
},
"rows": []any{},
},
}
},
},
{
Type: "script", Version: "1", Label: "分镜脚本", DefaultWidth: 920, DefaultHeight: 360,
Purpose: "维护结构化的多镜头脚本,支持镜头级审查、修改和媒体关联。",

View File

@@ -143,7 +143,7 @@ func (d Descriptor) ApplyPatch(node map[string]any, patch map[string]any) error
}
func (d Descriptor) ValidateConnection(fromKind string) error {
if !d.Connection.CanTarget || d.GenerationMode == "" {
if !d.Connection.CanTarget {
return fmt.Errorf("%s 节点不能接收参考输入", d.Label)
}
if !d.AllowsInput(fromKind) {