feat(previs): 图片生成预演台 - 从图片节点交给 Agent 复现为可编辑 3D 预演

图片工具栏新增「生成预演台」,自动选用支持看图的文本模型并提交复现指令。对话用节点卡片展示「此图」,普通图片演员只写名称时不再要求角色卡绑定。
This commit is contained in:
ddcat666
2026-10-09 17:17:28 +08:00
parent 5f322f2f5e
commit 8dcf0a252b
13 changed files with 282 additions and 23 deletions

View File

@@ -3,6 +3,11 @@ import { markdownPlainText } from "@/lib/markdown-plain-text";
import { getActiveUserScope } from "@/lib/user-scope";
import type { AgentPermissionMode, AgentRun } from "@/services/api/agent";
export type CloudAgentMessagePresentation = {
displayText?: string;
canvasReferenceNodeId?: string;
};
export type CloudAgentConversationMessage = {
id: string;
role: "user" | "assistant" | "system" | "tool" | "error";
@@ -37,7 +42,7 @@ type CloudAgentConversationDocument = {
conversations: CloudAgentConversation[];
};
export type CloudAgentPendingSubmission = {
export type CloudAgentPendingSubmission = CloudAgentMessagePresentation & {
fingerprint: string;
key: string;
request?: import("@/services/api/agent").CreateAgentRunInput;
@@ -89,7 +94,7 @@ export async function loadCloudAgentPendingSubmission(canvasId: string, conversa
if (parsed.request !== undefined && (!parsed.request || parsed.request.idempotencyKey !== parsed.key || parsed.request.canvasId !== canvasId || typeof parsed.request.prompt !== "string")) throw new Error("invalid request");
if (parsed.parentRunId !== undefined && typeof parsed.parentRunId !== "string") throw new Error("invalid parent");
if (parsed.messageId !== undefined && typeof parsed.messageId !== "string") throw new Error("invalid message");
return { fingerprint: parsed.fingerprint, key: parsed.key, request: parsed.request, parentRunId: parsed.parentRunId, messageId: parsed.messageId } satisfies CloudAgentPendingSubmission;
return { fingerprint: parsed.fingerprint, key: parsed.key, request: parsed.request, parentRunId: parsed.parentRunId, messageId: parsed.messageId, displayText: parsed.displayText, canvasReferenceNodeId: parsed.canvasReferenceNodeId } satisfies CloudAgentPendingSubmission;
} catch {
throw new Error("待确认请求记录损坏,已暂停本对话发送;请先在任务中心核对原运行,不要直接重复生成");
}