refactor(canvas): 预演台 - 重构工作台与场景交互链路

This commit is contained in:
ddcat666
2026-10-06 09:06:43 +08:00
parent 1dfc8ce7ac
commit 112916587c
128 changed files with 42372 additions and 5011 deletions

View File

@@ -154,7 +154,7 @@ func cloudAgentCompactSupersededReadResult(state *cloudAgentRuntime, current clo
if state == nil || !cloudAgentReadToolCacheable(current.Function.Name) {
return
}
if current.Function.Name != "canvas_get_state" && current.Function.Name != "canvas_read_storyboard" && current.Function.Name != "director_scene_read" {
if current.Function.Name != "canvas_get_state" && current.Function.Name != "canvas_read_storyboard" && current.Function.Name != "previs_scene_read" {
return
}
currentKey := cloudAgentReadCacheKey(current)
@@ -234,7 +234,7 @@ func cloudAgentCompactSupersededReadBody(content, toolName string) string {
delete(result, "rows")
removed = true
}
case "director_scene_read":
case "previs_scene_read":
for _, key := range []string{"content", "shots", "scenes"} {
if _, exists := result[key]; exists {
delete(result, key)
@@ -579,6 +579,18 @@ func (s *Service) advanceCloudAgentTool(run *model.CloudAgentExecution, state *c
if err == nil {
preview = batchPlan.Preview
}
case "previs_scene_create":
previsPlan, err := prepareCloudAgentPrevisSceneCreate(repo, run.UserID, state.Request.CanvasID, call)
mutationErr = err
if err == nil {
preview = previsPlan.Preview
}
case "previs_apply_patch":
previsPlan, err := prepareCloudAgentPrevisApplyPatch(repo, run.UserID, state.Request.CanvasID, call)
mutationErr = err
if err == nil {
preview = previsPlan.Preview
}
case "canvas_arrange_nodes":
arrangePlan, err := prepareCloudAgentArrangeNodes(repo, run.UserID, state.Request.CanvasID, call)
mutationErr = err
@@ -682,6 +694,8 @@ func (s *Service) advanceCloudAgentTool(run *model.CloudAgentExecution, state *c
result, toolErr = applyCloudAgentCharacterCreate(repo, run.UserID, state.Request.CanvasID, call, policy, cloudAgentCanvasEventRecorder(run.ID, state))
case call.Function.Name == "canvas_edit_batch_table":
result, toolErr = applyCloudAgentBatchTableMutation(repo, run.UserID, state.Request.CanvasID, call, policy, cloudAgentCanvasEventRecorder(run.ID, state))
case call.Function.Name == "previs_scene_create", call.Function.Name == "previs_apply_patch":
result, toolErr = applyCloudAgentPrevisMutation(repo, run.UserID, state.Request.CanvasID, call, policy, cloudAgentCanvasEventRecorder(run.ID, state))
case call.Function.Name == "canvas_inspect_image":
result, toolErr = inspectionResult, inspectionErr
if toolErr == nil && inspectionResult != nil {