添加生成资产视觉手册
This commit is contained in:
parent
292a0042ab
commit
618007d80b
@ -1,4 +1,4 @@
|
|||||||
name
|
name
|
||||||
123123水电费水电费水电费水电费水电费
|
123123水电费水电费水电费水电费水电费
|
||||||
123123123
|
12312312312
|
||||||
123123123
|
123123123
|
||||||
@ -84,16 +84,13 @@ export default router.post(
|
|||||||
});
|
});
|
||||||
const result: ResultItem[] = Object.values(itemMap);
|
const result: ResultItem[] = Object.values(itemMap);
|
||||||
|
|
||||||
const typeConfig: Record<string, { promptKey: string; itemType: ItemType; label: string; nameLabel: string }> = {
|
const typeConfig: Record<string, { promptKey: string; itemType: ItemType; label: string; nameLabel: string; visualManual: string }> = {
|
||||||
role: { promptKey: "role-polish", itemType: "characters", label: "角色标准四视图", nameLabel: "角色" },
|
role: { promptKey: "role-polish", itemType: "characters", label: "角色标准四视图", nameLabel: "角色", visualManual: "art_character" },
|
||||||
scene: { promptKey: "scene-polish", itemType: "scenes", label: "场景图", nameLabel: "场景" },
|
scene: { promptKey: "scene-polish", itemType: "scenes", label: "场景图", nameLabel: "场景", visualManual: "art_scene" },
|
||||||
tool: { promptKey: "tool-polish", itemType: "props", label: "道具图", nameLabel: "道具" },
|
tool: { promptKey: "tool-polish", itemType: "props", label: "道具图", nameLabel: "道具", visualManual: "art_prop" },
|
||||||
};
|
};
|
||||||
|
|
||||||
const novelData = (await u.db("o_novel").whereIn("chapterIndex", [1]).select("*")) as NovelChapter[];
|
const novelData = (await u.db("o_novel").whereIn("chapterIndex", [1]).select("*")) as NovelChapter[];
|
||||||
const novelText = mergeNovelText(novelData);
|
const novelText = mergeNovelText(novelData);
|
||||||
const data = await u.db("o_prompt").where("type", "assetsPromptGeneration").first("data");
|
|
||||||
|
|
||||||
// 批量更新所有 item 状态为生成中
|
// 批量更新所有 item 状态为生成中
|
||||||
const assetsIds = items.map((item: { assetsId: number }) => item.assetsId);
|
const assetsIds = items.map((item: { assetsId: number }) => item.assetsId);
|
||||||
await u.db("o_assets").whereIn("id", assetsIds).update({ promptState: "生成中" });
|
await u.db("o_assets").whereIn("id", assetsIds).update({ promptState: "生成中" });
|
||||||
@ -105,11 +102,12 @@ export default router.post(
|
|||||||
limit(async () => {
|
limit(async () => {
|
||||||
const config = typeConfig[item.type];
|
const config = typeConfig[item.type];
|
||||||
if (!config) return;
|
if (!config) return;
|
||||||
|
//获取到视觉手册
|
||||||
|
const visualManual = await u.getArtPrompt(project.artStyle as string, config.visualManual);
|
||||||
|
if (!visualManual) return res.status(500).send(error("视觉手册未定义"));
|
||||||
findItemByName(result, item.name, config.itemType);
|
findItemByName(result, item.name, config.itemType);
|
||||||
|
|
||||||
const systemPrompt = `${data?.data}
|
const systemPrompt = `
|
||||||
|
|
||||||
请根据以下参数生成${config.label}提示词:
|
请根据以下参数生成${config.label}提示词:
|
||||||
|
|
||||||
**基础参数:**
|
**基础参数:**
|
||||||
@ -122,6 +120,7 @@ export default router.post(
|
|||||||
- ${config.nameLabel}描述:${item.describe},
|
- ${config.nameLabel}描述:${item.describe},
|
||||||
|
|
||||||
请严格按照skill规范生成${item.type === "role" ? "人物角色四视图" : config.label}提示词。
|
请严格按照skill规范生成${item.type === "role" ? "人物角色四视图" : config.label}提示词。
|
||||||
|
${visualManual}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -85,27 +85,26 @@ export default router.post(
|
|||||||
|
|
||||||
const result: ResultItem[] = Object.values(itemMap);
|
const result: ResultItem[] = Object.values(itemMap);
|
||||||
|
|
||||||
const typeConfig: Record<string, { promptKey: string; itemType: ItemType; label: string; nameLabel: string }> = {
|
const typeConfig: Record<string, { promptKey: string; itemType: ItemType; label: string; nameLabel: string; visualManual: string }> = {
|
||||||
role: { promptKey: "role-polish", itemType: "characters", label: "角色标准四视图", nameLabel: "角色" },
|
role: { promptKey: "role-polish", itemType: "characters", label: "角色标准四视图", nameLabel: "角色", visualManual: "art_character" },
|
||||||
scene: { promptKey: "scene-polish", itemType: "scenes", label: "场景图", nameLabel: "场景" },
|
scene: { promptKey: "scene-polish", itemType: "scenes", label: "场景图", nameLabel: "场景", visualManual: "art_scene" },
|
||||||
tool: { promptKey: "tool-polish", itemType: "props", label: "道具图", nameLabel: "道具" },
|
tool: { promptKey: "tool-polish", itemType: "props", label: "道具图", nameLabel: "道具", visualManual: "art_prop" },
|
||||||
};
|
};
|
||||||
|
|
||||||
const config = typeConfig[type];
|
const config = typeConfig[type];
|
||||||
if (!config) return res.status(500).send(error("不支持的类型"));
|
if (!config) return res.status(500).send(error("不支持的类型"));
|
||||||
|
if (!config.visualManual) return res.status(500).send(error("视觉手册未定义"));
|
||||||
|
//获取到视觉手册
|
||||||
|
const visualManual = await u.getArtPrompt(project.artStyle as string, config.visualManual);
|
||||||
|
if (!visualManual) return res.status(500).send(error("视觉手册未定义"));
|
||||||
findItemByName(result, name, config.itemType);
|
findItemByName(result, name, config.itemType);
|
||||||
const novelData = (await u.db("o_novel").whereIn("chapterIndex", [1]).select("*")) as NovelChapter[];
|
const novelData = (await u.db("o_novel").whereIn("chapterIndex", [1]).select("*")) as NovelChapter[];
|
||||||
const novelText = mergeNovelText(novelData);
|
const novelText = mergeNovelText(novelData);
|
||||||
|
|
||||||
const data = await u.db("o_prompt").where("type", "assetsPromptGeneration").first("data");
|
const systemPrompt = `
|
||||||
|
|
||||||
const systemPrompt = `${data?.data}
|
|
||||||
|
|
||||||
请根据以下参数生成${config.label}提示词:
|
请根据以下参数生成${config.label}提示词:
|
||||||
|
|
||||||
**基础参数:**
|
**基础参数:**
|
||||||
- 风格: ${project?.artStyle || "未指定"}
|
|
||||||
- 小说类型: ${project?.type || "未指定"}
|
- 小说类型: ${project?.type || "未指定"}
|
||||||
- 小说背景: ${project?.intro || "未指定"}
|
- 小说背景: ${project?.intro || "未指定"}
|
||||||
|
|
||||||
@ -113,7 +112,8 @@ export default router.post(
|
|||||||
- ${config.nameLabel}名称:${name},
|
- ${config.nameLabel}名称:${name},
|
||||||
- ${config.nameLabel}描述:${describe},
|
- ${config.nameLabel}描述:${describe},
|
||||||
|
|
||||||
请严格按照skill规范生成${type === "role" ? "人物角色四视图" : config.label}提示词。
|
请严格按照skill规范生成${type === "role" ? "人物角色四视图" : config.label}提示词
|
||||||
|
${visualManual}。
|
||||||
`;
|
`;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
21
src/types/database.d.ts
vendored
21
src/types/database.d.ts
vendored
@ -1,12 +1,18 @@
|
|||||||
// @db-hash f7bc2fdb80756d5536929eb47155578b
|
// @db-hash e24c7c99757472b92af11f26a2b2b8c7
|
||||||
//该文件由脚本自动生成,请勿手动修改
|
//该文件由脚本自动生成,请勿手动修改
|
||||||
|
|
||||||
export interface _o_script_old_20260327 {
|
export interface _o_project_old_20260328 {
|
||||||
'content'?: string | null;
|
'artStyle'?: string | null;
|
||||||
'createTime'?: number | null;
|
'createTime'?: number | null;
|
||||||
'id'?: number;
|
'id'?: number | null;
|
||||||
|
'imageModel'?: string | null;
|
||||||
|
'intro'?: string | null;
|
||||||
'name'?: string | null;
|
'name'?: string | null;
|
||||||
'projectId'?: number | null;
|
'projectType'?: string | null;
|
||||||
|
'type'?: string | null;
|
||||||
|
'userId'?: number | null;
|
||||||
|
'videoModel'?: string | null;
|
||||||
|
'videoRatio'?: string | null;
|
||||||
}
|
}
|
||||||
export interface memories {
|
export interface memories {
|
||||||
'content': string;
|
'content': string;
|
||||||
@ -54,6 +60,7 @@ export interface o_assets {
|
|||||||
'name'?: string | null;
|
'name'?: string | null;
|
||||||
'projectId'?: number | null;
|
'projectId'?: number | null;
|
||||||
'prompt'?: string | null;
|
'prompt'?: string | null;
|
||||||
|
'promptState'?: string | null;
|
||||||
'remark'?: string | null;
|
'remark'?: string | null;
|
||||||
'scriptId'?: number | null;
|
'scriptId'?: number | null;
|
||||||
'startTime'?: number | null;
|
'startTime'?: number | null;
|
||||||
@ -173,7 +180,7 @@ export interface o_storyboard {
|
|||||||
'filePath'?: string | null;
|
'filePath'?: string | null;
|
||||||
'frameMode'?: string | null;
|
'frameMode'?: string | null;
|
||||||
'id'?: number;
|
'id'?: number;
|
||||||
'index'?: string | null;
|
'index'?: number | null;
|
||||||
'lines'?: string | null;
|
'lines'?: string | null;
|
||||||
'mode'?: string | null;
|
'mode'?: string | null;
|
||||||
'model'?: string | null;
|
'model'?: string | null;
|
||||||
@ -238,7 +245,7 @@ export interface o_videoConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface DB {
|
export interface DB {
|
||||||
"_o_script_old_20260327": _o_script_old_20260327;
|
"_o_project_old_20260328": _o_project_old_20260328;
|
||||||
"memories": memories;
|
"memories": memories;
|
||||||
"o_agentDeploy": o_agentDeploy;
|
"o_agentDeploy": o_agentDeploy;
|
||||||
"o_agentWorkData": o_agentWorkData;
|
"o_agentWorkData": o_agentWorkData;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user