This commit is contained in:
zhishi 2026-03-29 02:10:58 +08:00
commit 3a3b756e14
3 changed files with 116 additions and 11 deletions

View File

@ -260,6 +260,101 @@ export default async (knex: Knex, forceInit: boolean = false): Promise<void> =>
type: "assetsPromptGeneration",
data: "# 资产提示词生成指令 根据提供的项目参数和资产设定,生成符合要求的提示词\n\n请根据以下参数生成提示词\n\n**基础参数:**\n- 风格: {风格}\n- 小说类型: {小说类型}\n- 小说背景: {小说背景}\n\n**资产设定:**\n- 类型: {角色/场景/道具}\n- 名称:{名称}\n- 描述:{描述}\n\n请严格按照skill规范生成提示词。",
},
{
name: "剧本资产提取",
type: "scriptAssetExtraction",
data: `
---
name: universal_agent
description: 专注于从剧本内容中提取所使用的资产
---
# Script Assets Extract
使
## 使
AI
##
-
- \`role\` — 角色(对应 \`o_assets.type = "role"\`
- \`scene\` — 场景(对应 \`o_assets.type = "scene"\`
- \`tool\` — 道具(对应 \`o_assets.type = "tool"\`
- AI
##
** \`resultTool\` 工具返回结果**禁止以纯文本、Markdown 表格或 JSON 代码块等形式直接输出资产列表。
\`resultTool\` 的 schema 会对字段类型和枚举值做强校验,调用时请严格按照下方字段定义填写,确保数据结构正确、字段完整、类型匹配。
| | | | |
| ---- | ---- | ---- | ---- |
| \`name\` | string | 是 | 资产名称,使用剧本中的原始称呼,不做其他多余描述 |
| \`desc\` | string | 是 | 资产描述30-80 字的视觉化描述 |
| \`prompt\` | string | 是 | 生成提示词,英文,用于 AI 图片生成 |
| \`type\` | enum | 是 | 资产类型:\`role\` / \`scene\` / \`tool\` |
##
### role
-
- \`desc\`:包含外貌特征、服饰风格、体态气质等视觉要素
- \`prompt\`:英文提示词,描述角色的外观特征,适用于 AI 角色图生成
- \`name\`
- "路人甲""士兵"
### scene
- /
- \`desc\`:包含空间结构、光照氛围、关键陈设、色调基调等视觉要素
- \`prompt\`:英文提示词,描述场景的整体视觉风格,适用于 AI 场景图生成
- / \`desc\` 中注明即可
### tool
- /
- \`desc\`:包含外观形状、颜色材质、尺寸参考、特殊效果等视觉要素
- \`prompt\`:英文提示词,描述道具的外观细节,适用于 AI 道具图生成
-
## prompt
- /
- ****
- anime style, manga style
- prompt \`a young man, sharp eyebrows, black hair, pale skin, wearing a gray Taoist robe, slender build, cold expression\`
- prompt \`dark cave interior, glowing crystals on walls, misty atmosphere, dim blue lighting, stone altar in center\`
- prompt \`ancient jade pendant, oval shape, translucent green, carved dragon pattern, glowing faintly\`
##
1.
2. \`name\`\`desc\`\`prompt\`\`type\`
3.
4. ** \`resultTool\` 工具输出完整资产列表**,不要分多次调用,一次性将所有资产放入 \`assetsList\` 数组中提交
##
1. ****
2. ****便 AI
3. ****
4. **** role/scene/tool
5. **** AI
##
- ****使
-
-
`,
},
]);
},
},

View File

@ -156,13 +156,13 @@ export default router.post(
});
try {
const skill = await useSkill("universal_agent.md");//todo改为AI
const data = await u.db("o_prompt").where("type", "scriptAssetExtraction").first("data");
await intansce.invoke({
messages: [
{
role: "system",
content:
skill.prompt +
data?.data +
"\n\n提取剧本中涉及的资产角色、场景、道具参考技能 script_assets_extract 规范,结果必须通过 resultTool 工具返回。",
},
{
@ -170,13 +170,16 @@ export default router.post(
content: `请根据以下剧本提取对应的剧本资产(角色、场景、道具、素材片段):\n\n${script.content}`,
},
],
tools: { ...skill.tools, resultTool },
tools: { resultTool },
});
} catch (e: any) {
const msg = e?.message || String(e);
console.error(`[extractAssets] scriptId=${scriptId} name=${script.name} 提取失败:`, msg);
errors.push({ scriptId, error: script.name + ":" + u.error(e).message });
await u.db("o_script").where("id", scriptId).update({ extractState: -1, errorReason: u.error(e).message });
await u
.db("o_script")
.where("id", scriptId)
.update({ extractState: -1, errorReason: u.error(e).message });
return null;
}

View File

@ -1,12 +1,18 @@
// @db-hash f7bc2fdb80756d5536929eb47155578b
// @db-hash e24c7c99757472b92af11f26a2b2b8c7
//该文件由脚本自动生成,请勿手动修改
export interface _o_script_old_20260327 {
'content'?: string | null;
export interface _o_project_old_20260328 {
'artStyle'?: string | null;
'createTime'?: number | null;
'id'?: number;
'id'?: number | null;
'imageModel'?: string | null;
'intro'?: 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 {
'content': string;
@ -54,6 +60,7 @@ export interface o_assets {
'name'?: string | null;
'projectId'?: number | null;
'prompt'?: string | null;
'promptState'?: string | null;
'remark'?: string | null;
'scriptId'?: number | null;
'startTime'?: number | null;
@ -173,7 +180,7 @@ export interface o_storyboard {
'filePath'?: string | null;
'frameMode'?: string | null;
'id'?: number;
'index'?: string | null;
'index'?: number | null;
'lines'?: string | null;
'mode'?: string | null;
'model'?: string | null;
@ -238,7 +245,7 @@ export interface o_videoConfig {
}
export interface DB {
"_o_script_old_20260327": _o_script_old_20260327;
"_o_project_old_20260328": _o_project_old_20260328;
"memories": memories;
"o_agentDeploy": o_agentDeploy;
"o_agentWorkData": o_agentWorkData;