fix agent scene preset prompt merge
Some checks failed
Lint / build (20) (push) Has been cancelled
Playwright Tests / test (push) Has been cancelled

This commit is contained in:
Your Name 2026-03-26 14:16:31 +08:00
parent 04428bf6b2
commit 5f54531f75

View File

@ -3115,6 +3115,7 @@ function buildAgentSlotPrompt(params: {
function buildAgentSceneWorkflowPrompt(params: {
workflowPrompt?: string | null;
slotPrompt?: string | null;
userSupplementPrompt?: string | null;
imageRolePrompt?: string | null;
}) {
@ -3123,6 +3124,10 @@ function buildAgentSceneWorkflowPrompt(params: {
if (workflowPrompt) {
lines.push(workflowPrompt);
}
const slotPrompt = String(params.slotPrompt || "").trim();
if (slotPrompt) {
lines.push(slotPrompt);
}
const imageRolePrompt = String(params.imageRolePrompt || "").trim();
if (imageRolePrompt) {
lines.push(imageRolePrompt);
@ -7316,9 +7321,17 @@ export async function POST(request: Request) {
productImageCount: sceneProductSlotCount,
includeModelImage: sceneModelSlotEnabled,
});
const rawSceneSlotPrompt =
sceneSlot?.promptTemplate || selectedAgentPreset.promptTemplate || "";
const dedupedSceneSlotPrompt = dedupeAgentSlotPromptAgainstWorkflow({
workflowPrompt: hiddenPromptText || null,
slotPrompt: rawSceneSlotPrompt,
modeType: "scene_generation",
});
const scenePrompt =
buildAgentSceneWorkflowPrompt({
workflowPrompt: hiddenPromptText || null,
slotPrompt: dedupedSceneSlotPrompt || null,
imageRolePrompt: sceneImageRolePrompt,
userSupplementPrompt: sanitizedUserSupplementPrompt || null,
}) ||
@ -7338,6 +7351,7 @@ export async function POST(request: Request) {
includesWorkflowPrompt: Boolean(hiddenPromptText),
includesUserSupplementPrompt: Boolean(sanitizedUserSupplementPrompt),
includesModelImage: sceneModelSlotEnabled,
includesSceneSlotPrompt: Boolean(dedupedSceneSlotPrompt),
productImageCount: sceneProductSlotCount,
uploadedImageCount: sharedUploadedImageUrls.length,
hasProductIdentityLock: sceneImageRolePrompt.includes("【产品锁定约束】"),
@ -7345,6 +7359,11 @@ export async function POST(request: Request) {
hasModelClothingOverrideRule: sceneImageRolePrompt.includes(
"只有当工作流设定或补充要求里明确要求修改模特衣服"
),
sceneSlotPromptPreview: dedupedSceneSlotPrompt
.split("\n")
.map((line) => line.trim())
.filter(Boolean)
.slice(0, 10),
imageRolePreview: sceneImageRolePrompt
.split("\n")
.map((line) => line.trim())