From 17dcfcd55d075f91387d2c02c5c7e888fa79168c Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 27 Mar 2026 11:01:13 +0800 Subject: [PATCH] feat: add PSD template font rendering workflow --- .../settings/admin-settings-client.tsx | 11 +- .../agent-workflow-settings-client.tsx | 6 + .../agent-workflow/psd-templates/page.tsx | 19 + .../psd-templates-settings-client.tsx | 1256 +++++++++++++++++ app/api/admin/psd-fonts/[id]/route.ts | 72 + app/api/admin/psd-fonts/route.ts | 133 ++ app/api/admin/psd-templates/[id]/route.ts | 206 +++ app/api/admin/psd-templates/route.ts | 198 +++ app/api/psd-templates/render/route.ts | 121 ++ app/api/psd-templates/route.ts | 44 + .../agents/AgentGenerationWorkspaceDarkV2.tsx | 44 +- .../agents/AgentPsdTemplateEditorDialog.tsx | 464 ++++++ docs/智能体PSD模板替换开发文档-2026-03-26.md | 702 +++++++++ lib/agents/psd-font-config.ts | 90 ++ lib/agents/psd-font-settings.ts | 30 + lib/agents/psd-template-config.ts | 361 +++++ lib/agents/psd-template-parser.ts | 339 +++++ lib/agents/psd-template-renderer.ts | 342 +++++ lib/agents/psd-template-settings.ts | 53 + lib/storage/service.ts | 6 + package.json | 1 + pnpm-lock.yaml | 8 + 22 files changed, 4501 insertions(+), 5 deletions(-) create mode 100644 app/(admin)/settings/agent-workflow/psd-templates/page.tsx create mode 100644 app/(admin)/settings/agent-workflow/psd-templates/psd-templates-settings-client.tsx create mode 100644 app/api/admin/psd-fonts/[id]/route.ts create mode 100644 app/api/admin/psd-fonts/route.ts create mode 100644 app/api/admin/psd-templates/[id]/route.ts create mode 100644 app/api/admin/psd-templates/route.ts create mode 100644 app/api/psd-templates/render/route.ts create mode 100644 app/api/psd-templates/route.ts create mode 100644 components/agents/AgentPsdTemplateEditorDialog.tsx create mode 100644 docs/智能体PSD模板替换开发文档-2026-03-26.md create mode 100644 lib/agents/psd-font-config.ts create mode 100644 lib/agents/psd-font-settings.ts create mode 100644 lib/agents/psd-template-config.ts create mode 100644 lib/agents/psd-template-parser.ts create mode 100644 lib/agents/psd-template-renderer.ts create mode 100644 lib/agents/psd-template-settings.ts diff --git a/app/(admin)/settings/admin-settings-client.tsx b/app/(admin)/settings/admin-settings-client.tsx index 29a3db670..a01367f6b 100644 --- a/app/(admin)/settings/admin-settings-client.tsx +++ b/app/(admin)/settings/admin-settings-client.tsx @@ -6224,9 +6224,14 @@ export function AdminSettingsClient() { 建议在独立页面中维护每个环节的按钮名称、预览图上传、说明文案和 Prompt 片段。 - +
+ + +
diff --git a/app/(admin)/settings/agent-workflow/agent-workflow-settings-client.tsx b/app/(admin)/settings/agent-workflow/agent-workflow-settings-client.tsx index 98cb4a4bb..ad3c9699d 100644 --- a/app/(admin)/settings/agent-workflow/agent-workflow-settings-client.tsx +++ b/app/(admin)/settings/agent-workflow/agent-workflow-settings-client.tsx @@ -1926,6 +1926,12 @@ export function AgentWorkflowSettingsClient({
+ + +
+ + + + +
+
+
+ + {templates.length} + + 模板数量 + + {fonts.length} + + 字体数量 + + {countEditableLayers(draftTemplate)} + + 当前可编辑槽位 + + {countEditableTextLayers(draftTemplate)} + + 当前文字槽位 + {draftTemplate ? ( + <> + + {draftTemplate.status === "active" ? "已启用" : "未启用"} + + + {draftTemplate.width} x {draftTemplate.height} + + + ) : null} +
+
+
+ +
+
+ + + 上传新模板 + 支持 PSD / PSB,建议图层命名清晰,便于后台配置图片位和文字位。 + + +
+ + setUploadName(event.target.value)} + placeholder="例如:主图包装模板" + /> +
+
+ +