feat: add style kit production standards
This commit is contained in:
+14
-2
@@ -17,6 +17,7 @@ import { productionGraph } from "./production.mjs";
|
||||
import { dispatchNotificationEvent } from "./notifications.mjs";
|
||||
import { registerJobArtifacts } from "./media-artifacts.mjs";
|
||||
import { resolveKnowledgeContextForJob } from "./knowledge.mjs";
|
||||
import { effectiveStyleKitForProject, styleKitForbiddenTerms, styleKitNegativeTerms } from "./style-kits.mjs";
|
||||
|
||||
const projectRoot = resolve(import.meta.dirname, "..");
|
||||
const jobStorageRoot = resolve(projectRoot, "storage", "jobs");
|
||||
@@ -373,13 +374,15 @@ function buildContract(context, body, adapter, routing = null, preflight = {}) {
|
||||
const shot = shotForJob(context, body.shotId);
|
||||
const kind = String(body.kind || "自定义生成任务").trim();
|
||||
const knowledge = resolveKnowledgeContextForJob(context, body);
|
||||
const styleKit = context.project ? effectiveStyleKitForProject(context, context.project.id).styleKit : null;
|
||||
const inputs = { ...(body.inputs || {}) };
|
||||
if (knowledge) {
|
||||
inputs.knowledgeContext = knowledge.promptContext;
|
||||
inputs.knowledgeCitations = knowledge.citations;
|
||||
inputs.knowledgeChunkIds = knowledge.chunkIds;
|
||||
}
|
||||
const blockedTerms = ["split-screen", "comic panel", "collage", "contact sheet", "storyboard", "多格", "拼图", "分屏", "故事板拼图"];
|
||||
const blockedTerms = styleKitForbiddenTerms(styleKit);
|
||||
const negativeTerms = styleKitNegativeTerms(styleKit);
|
||||
// Negative prompts intentionally name the forbidden layouts; only inspect positive generation text here.
|
||||
const promptText = [shot?.prompt, shot?.videoPrompt, shot?.action, shot?.camera, body.prompt].filter(Boolean).join(" ").toLowerCase();
|
||||
const blocked = blockedTerms.filter((term) => promptText.includes(term.toLowerCase()));
|
||||
@@ -408,15 +411,24 @@ function buildContract(context, body, adapter, routing = null, preflight = {}) {
|
||||
} : null,
|
||||
preflight,
|
||||
knowledge,
|
||||
styleKit,
|
||||
shot,
|
||||
inputs,
|
||||
constraints: {
|
||||
singleFrameOnly: true,
|
||||
imageOutputCount: 1,
|
||||
batchSize: 1,
|
||||
requireActualLastFrame: true,
|
||||
localOnly: routing ? routing.policyMode === "local-only" || routing.connectorCostMode === "local" : adapter.costMode === "local",
|
||||
approvalRequired: Boolean(routing?.requiresApproval || adapter.approvalRequired),
|
||||
blockedTerms
|
||||
blockedTerms,
|
||||
negativePromptTerms: negativeTerms,
|
||||
styleEnforcement: styleKit?.source || "default-contract",
|
||||
aspectRatio: styleKit?.deliverySpec?.aspectRatio || "9:16",
|
||||
resolution: styleKit?.deliverySpec?.resolution || "1080x1920",
|
||||
fps: styleKit?.deliverySpec?.fps || 24,
|
||||
voicePolicy: styleKit?.voicePolicy || null,
|
||||
subtitlePreset: styleKit?.subtitlePreset || null
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user