feat(*): Agent工作流 - 完善审批、分镜协作与资源交互体验

This commit is contained in:
ddcat666
2026-10-11 22:23:11 +08:00
parent 435bc487cf
commit 298bee1fa9
38 changed files with 508 additions and 1263 deletions

View File

@@ -1,5 +1,5 @@
import { describe, expect, it } from "bun:test";
import { AGENT_APPROVAL_SUPERSEDED_BY_NODE, agentApprovalMatchesSettings, agentApprovalModel, agentApprovalModelSelection, agentApprovalTargetGenerating, agentImageApproval, agentMediaApprovalTargetNodeId } from "../src/lib/canvas/agent-media-approval";
import { AGENT_APPROVAL_SUPERSEDED_BY_NODE, agentApprovalMatchesSettings, agentApprovalModel, agentApprovalModelSelection, agentApprovalTargetGenerating, agentImageApproval, agentMediaApprovalTargetNodeId, agentVideoApproval } from "../src/lib/canvas/agent-media-approval";
import type { CanvasNodeData } from "../src/types/canvas";
import { createModelChannel, defaultConfig, encodeChannelModel } from "../src/stores/use-config-store";
@@ -40,6 +40,15 @@ describe("image generation approval settings", () => {
});
});
describe("video generation approval settings", () => {
it("reads video duration and audio options", () => {
const approval = agentVideoApproval({ toolName: "generate_media", arguments: { mode: "video", prompt: "镜头运动", size: "9:16", quality: "720p", durationSeconds: 8, videoGenerateAudio: true, channelId: "platform", channelModelKey: "seedance-test", referenceNodeIds: ["image"] } });
expect(approval?.durationSeconds).toBe(8);
expect(approval?.videoGenerateAudio).toBe(true);
expect(approval?.referenceNodeIds).toEqual(["image"]);
});
});
describe("approval target already generating on the canvas", () => {
const detail = { toolName: "generate_media", arguments: JSON.stringify({ mode: "image", prompt: "p", size: "1:1", nodeId: "draft-1" }) };
const node = (metadata: Record<string, unknown>) => ({ id: "draft-1", type: "image", title: "开场分镜", position: { x: 0, y: 0 }, width: 200, height: 200, metadata }) as unknown as CanvasNodeData;