feat(agent): 云端创作助手 - 增加创作锚点、媒体准入与结构化分镜能力
This commit is contained in:
1 parent
40aca20f4d
commit
be9b22a697
22 files changed
+1686
-60
No files matched your search
@@ -9,7 +9,11 @@ func BuiltinRegistry() *Registry {
|
||||
registry, err := NewRegistry([]Descriptor{
|
||||
{
|
||||
Type: "text", Version: "1", Label: "文本", DefaultWidth: 340, DefaultHeight: 240,
|
||||
InputKind: "text", Connection: ConnectionPolicy{CanSource: true}, CanUpdate: true,
|
||||
Purpose: "承载普通说明、创意草稿和单段提示词。",
|
||||
GoodFor: []string{"单个创意", "一次性提示词", "临时备注", "快速试验"},
|
||||
NotIdealFor: []string{"多镜头脚本", "需要逐镜修改的内容", "需要镜头级资产关系的内容"},
|
||||
Tradeoffs: []string{"创建和编辑最轻量", "没有镜头级字段和逐镜维护能力"},
|
||||
InputKind: "text", Connection: ConnectionPolicy{CanSource: true}, CanUpdate: true,
|
||||
SummaryFields: []string{"content"}, DetailFields: []string{"content"},
|
||||
PatchFields: editableNodeFields("metadata.content", "正文", "节点正文"),
|
||||
CreateMetadata: func(content string) map[string]any {
|
||||
@@ -18,7 +22,11 @@ func BuiltinRegistry() *Registry {
|
||||
},
|
||||
{
|
||||
Type: "markdown", Version: "1", Label: "Markdown", DefaultWidth: 420, DefaultHeight: 320,
|
||||
InputKind: "text", Connection: ConnectionPolicy{CanSource: true}, CanUpdate: true,
|
||||
Purpose: "承载面向人阅读的方案、脚本草稿和格式化文档。",
|
||||
GoodFor: []string{"创意方案", "脚本草稿", "交付文档", "需要排版的长文本"},
|
||||
NotIdealFor: []string{"需要逐镜生成或审核的多镜头内容", "需要绑定媒体资产的结构化流程"},
|
||||
Tradeoffs: []string{"适合阅读和导出", "结构化程度低,不能替代可维护的分镜表"},
|
||||
InputKind: "text", Connection: ConnectionPolicy{CanSource: true}, CanUpdate: true,
|
||||
SummaryFields: []string{"content"}, DetailFields: []string{"content"},
|
||||
PatchFields: editableNodeFields("metadata.content", "Markdown 正文", "Markdown 正文"),
|
||||
},
|
||||
@@ -33,6 +41,10 @@ func BuiltinRegistry() *Registry {
|
||||
}),
|
||||
{
|
||||
Type: "frame", Version: "1", Label: "背板", DefaultWidth: 760, DefaultHeight: 520,
|
||||
Purpose: "组织一组相关节点的画布区域。",
|
||||
GoodFor: []string{"按场景整理节点", "划分工作区域"},
|
||||
NotIdealFor: []string{"承载结构化镜头数据", "替代具体业务节点"},
|
||||
Tradeoffs: []string{"改善空间组织但不增加内容结构或生成能力"},
|
||||
SummaryFields: []string{"label"}, DetailFields: []string{"label"},
|
||||
CreateMetadata: func(string) map[string]any {
|
||||
return map[string]any{"frame": map[string]any{"collapsed": false, "expandedWidth": float64(760), "expandedHeight": float64(520)}}
|
||||
@@ -40,6 +52,11 @@ func BuiltinRegistry() *Registry {
|
||||
},
|
||||
{
|
||||
Type: "script", Version: "1", Label: "分镜脚本", DefaultWidth: 920, DefaultHeight: 360,
|
||||
Purpose: "维护结构化的多镜头脚本,支持镜头级审查、修改和媒体关联。",
|
||||
GoodFor: []string{"多镜头规划", "镜头连续性", "逐镜审查和微调", "逐镜生成图片或视频", "需要他人接手维护的内容"},
|
||||
NotIdealFor: []string{"只有一个画面的快速试验", "一次性临时提示词", "仅需要阅读排版的普通文档"},
|
||||
Tradeoffs: []string{"前期录入成本高于文本节点", "但能保留镜头级结构、资产关系和后续维护能力"},
|
||||
Actions: []string{"read_rows", "append_row", "update_row", "remove_row", "generate_storyboard"},
|
||||
SummaryFields: []string{"storyboard"}, DetailFields: []string{"storyboard"}, ProjectionKind: "storyboard", ProjectionField: "storyboard",
|
||||
CreateMetadata: func(string) map[string]any {
|
||||
return map[string]any{"status": "idle", "workflowKind": "script", "storyboard": map[string]any{"rows": []any{}, "visibleColumns": []any{"shotNumber", "durationSeconds", "videoMotionPrompt", "dialogue", "assets"}, "referenceNodeIds": []any{}}}
|
||||
@@ -53,8 +70,11 @@ func BuiltinRegistry() *Registry {
|
||||
}
|
||||
|
||||
func generatedMediaDescriptor(nodeType, version, label string, width, height float64, generationMode string, connection ConnectionPolicy) Descriptor {
|
||||
semantics := generatedMediaSemantics(nodeType)
|
||||
return Descriptor{
|
||||
Type: nodeType, Version: version, Label: label, DefaultWidth: width, DefaultHeight: height,
|
||||
Purpose: semantics.Purpose, GoodFor: semantics.GoodFor, NotIdealFor: semantics.NotIdealFor,
|
||||
Tradeoffs: semantics.Tradeoffs, Actions: semantics.Actions,
|
||||
InputKind: nodeType, GenerationMode: generationMode, Connection: connection, CanUpdate: true,
|
||||
SummaryFields: []string{"prompt", "composerContent", "assetTags", "referenceNodeIds"},
|
||||
DetailFields: []string{"prompt", "composerContent", "assetTags", "referenceNodeIds"},
|
||||
@@ -63,6 +83,45 @@ func generatedMediaDescriptor(nodeType, version, label string, width, height flo
|
||||
}
|
||||
}
|
||||
|
||||
type generatedMediaCapabilitySemantics struct {
|
||||
Purpose string
|
||||
GoodFor []string
|
||||
NotIdealFor []string
|
||||
Tradeoffs []string
|
||||
Actions []string
|
||||
}
|
||||
|
||||
func generatedMediaSemantics(nodeType string) generatedMediaCapabilitySemantics {
|
||||
switch nodeType {
|
||||
case "image":
|
||||
return generatedMediaCapabilitySemantics{
|
||||
Purpose: "生成或承载一个静态画面,并作为后续图片或视频生成的真实参考素材。",
|
||||
GoodFor: []string{"单张图片生成", "有参考图的图片生成", "分镜首帧和关键帧", "需要复用的视觉素材"},
|
||||
NotIdealFor: []string{"承载多镜头脚本结构", "表达镜头运动或时间变化", "代替分镜表维护镜头连续性"},
|
||||
Tradeoffs: []string{"一个节点对应一个静态媒体目标", "参考图数量和生成方式必须再由模型目录能力匹配"},
|
||||
Actions: []string{"generate_media", "update_prompt", "use_as_reference"},
|
||||
}
|
||||
case "video":
|
||||
return generatedMediaCapabilitySemantics{
|
||||
Purpose: "生成或承载一个连续视频片段;可按实际参考素材执行文生视频、图生视频或多图生视频。",
|
||||
GoodFor: []string{"单镜头文生视频", "单图生视频", "多图参考视频", "已有视频或音频参与的视频生成"},
|
||||
NotIdealFor: []string{"承载整部多镜头脚本", "用一个节点代替逐镜审查和维护", "未查询模型能力就假定支持任意参考数量"},
|
||||
Tradeoffs: []string{"一个节点通常对应一个可独立生成和审核的视频片段", "参考类型、数量、时长、画幅、音频和价格受当前模型目录约束"},
|
||||
Actions: []string{"generate_media", "update_prompt", "use_as_reference"},
|
||||
}
|
||||
case "audio":
|
||||
return generatedMediaCapabilitySemantics{
|
||||
Purpose: "生成或承载一个音频素材,用于配音、音乐、音效或视频参考输入。",
|
||||
GoodFor: []string{"文本转语音", "配音", "音乐或音效素材", "为视频提供音频参考"},
|
||||
NotIdealFor: []string{"承载分镜结构", "表达画面构图或镜头运动", "代替视频节点"},
|
||||
Tradeoffs: []string{"一个节点对应一个音频目标且最多接收一个文本输入", "音频类型、时长和价格仍以模型目录及任务准入为准"},
|
||||
Actions: []string{"generate_media", "update_prompt", "use_as_reference"},
|
||||
}
|
||||
default:
|
||||
return generatedMediaCapabilitySemantics{}
|
||||
}
|
||||
}
|
||||
|
||||
func editableNodeFields(contentPath, contentLabel, contentDescription string) map[string]PatchField {
|
||||
return map[string]PatchField{
|
||||
"title": {
|
||||
|
||||
@@ -38,6 +38,11 @@ type Descriptor struct {
|
||||
Type string
|
||||
Version string
|
||||
Label string
|
||||
Purpose string
|
||||
GoodFor []string
|
||||
NotIdealFor []string
|
||||
Tradeoffs []string
|
||||
Actions []string
|
||||
DefaultWidth float64
|
||||
DefaultHeight float64
|
||||
InputKind string
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
const SetVersion = "canvas-capabilities/v3"
|
||||
const SetVersion = "canvas-capabilities/v4"
|
||||
|
||||
type Registry struct{ descriptors map[string]Descriptor }
|
||||
|
||||
@@ -20,6 +20,11 @@ func NewRegistry(descriptors []Descriptor) (*Registry, error) {
|
||||
descriptor.Type = normalizeType(descriptor.Type)
|
||||
descriptor.Version = strings.TrimSpace(descriptor.Version)
|
||||
descriptor.Label = strings.TrimSpace(descriptor.Label)
|
||||
descriptor.Purpose = strings.TrimSpace(descriptor.Purpose)
|
||||
descriptor.GoodFor = normalizeFields(descriptor.GoodFor)
|
||||
descriptor.NotIdealFor = normalizeFields(descriptor.NotIdealFor)
|
||||
descriptor.Tradeoffs = normalizeFields(descriptor.Tradeoffs)
|
||||
descriptor.Actions = normalizeFields(descriptor.Actions)
|
||||
if descriptor.Type == "" || descriptor.Version == "" || descriptor.Label == "" || descriptor.DefaultWidth <= 0 || descriptor.DefaultHeight <= 0 {
|
||||
return nil, fmt.Errorf("invalid canvas capability descriptor %q", descriptor.Type)
|
||||
}
|
||||
@@ -183,6 +188,10 @@ func normalizeFields(fields []string) []string {
|
||||
func cloneDescriptor(descriptor Descriptor) Descriptor {
|
||||
descriptor.Connection.AcceptedInputKinds = append([]string(nil), descriptor.Connection.AcceptedInputKinds...)
|
||||
descriptor.Connection.RejectedInputKinds = append([]string(nil), descriptor.Connection.RejectedInputKinds...)
|
||||
descriptor.GoodFor = append([]string(nil), descriptor.GoodFor...)
|
||||
descriptor.NotIdealFor = append([]string(nil), descriptor.NotIdealFor...)
|
||||
descriptor.Tradeoffs = append([]string(nil), descriptor.Tradeoffs...)
|
||||
descriptor.Actions = append([]string(nil), descriptor.Actions...)
|
||||
descriptor.SummaryFields = append([]string(nil), descriptor.SummaryFields...)
|
||||
descriptor.DetailFields = append([]string(nil), descriptor.DetailFields...)
|
||||
patchFields := make(map[string]PatchField, len(descriptor.PatchFields))
|
||||
@@ -197,6 +206,11 @@ type hashDescriptor struct {
|
||||
Type string
|
||||
Version string
|
||||
Label string
|
||||
Purpose string
|
||||
GoodFor []string
|
||||
NotIdealFor []string
|
||||
Tradeoffs []string
|
||||
Actions []string
|
||||
DefaultWidth float64
|
||||
DefaultHeight float64
|
||||
InputKind string
|
||||
@@ -244,6 +258,8 @@ func registryHashItems(descriptors []Descriptor) []hashDescriptor {
|
||||
}
|
||||
items = append(items, hashDescriptor{
|
||||
Type: descriptor.Type, Version: descriptor.Version, Label: descriptor.Label,
|
||||
Purpose: descriptor.Purpose, GoodFor: descriptor.GoodFor, NotIdealFor: descriptor.NotIdealFor,
|
||||
Tradeoffs: descriptor.Tradeoffs, Actions: descriptor.Actions,
|
||||
DefaultWidth: descriptor.DefaultWidth, DefaultHeight: descriptor.DefaultHeight,
|
||||
InputKind: descriptor.InputKind, GenerationMode: descriptor.GenerationMode,
|
||||
ProjectionKind: descriptor.ProjectionKind, ProjectionField: descriptor.ProjectionField,
|
||||
|
||||
Reference in new issue
Block a user