Merge branch '108' of https://github.com/HBAI-Ltd/Toonflow-app into 108
This commit is contained in:
commit
7c51b95992
@ -79,7 +79,7 @@ export default async (knex: Knex, forceInit: boolean = false): Promise<void> =>
|
|||||||
modelName: "",
|
modelName: "",
|
||||||
vendorId: null,
|
vendorId: null,
|
||||||
key: "scriptAgent",
|
key: "scriptAgent",
|
||||||
name: "剧本Agent",
|
name: "剧本AI",
|
||||||
desc: "用于读取原文生成故事骨架、改编策略,建议使用具备强大文本理解和生成能力的模型",
|
desc: "用于读取原文生成故事骨架、改编策略,建议使用具备强大文本理解和生成能力的模型",
|
||||||
disabled: false,
|
disabled: false,
|
||||||
},
|
},
|
||||||
@ -88,7 +88,7 @@ export default async (knex: Knex, forceInit: boolean = false): Promise<void> =>
|
|||||||
modelName: "",
|
modelName: "",
|
||||||
vendorId: null,
|
vendorId: null,
|
||||||
key: "productionAgent",
|
key: "productionAgent",
|
||||||
name: "生产Agent",
|
name: "生产AI",
|
||||||
desc: "对工作流进行调度和管理,建议使用具备较强的逻辑推理和任务管理能力的模型",
|
desc: "对工作流进行调度和管理,建议使用具备较强的逻辑推理和任务管理能力的模型",
|
||||||
disabled: false,
|
disabled: false,
|
||||||
},
|
},
|
||||||
@ -96,7 +96,7 @@ export default async (knex: Knex, forceInit: boolean = false): Promise<void> =>
|
|||||||
model: "",
|
model: "",
|
||||||
modelName: "",
|
modelName: "",
|
||||||
vendorId: null,
|
vendorId: null,
|
||||||
key: "universalAi",
|
key: "universalAgent",
|
||||||
name: "通用AI",
|
name: "通用AI",
|
||||||
desc: "用于小说事件提取、资产提示词生成、台词提取等边缘功能,建议使用具备较强文本处理能力的模型",
|
desc: "用于小说事件提取、资产提示词生成、台词提取等边缘功能,建议使用具备较强文本处理能力的模型",
|
||||||
disabled: false,
|
disabled: false,
|
||||||
@ -196,7 +196,72 @@ export default async (knex: Knex, forceInit: boolean = false): Promise<void> =>
|
|||||||
table.primary(["id"]);
|
table.primary(["id"]);
|
||||||
table.unique(["id"]);
|
table.unique(["id"]);
|
||||||
},
|
},
|
||||||
initData: async (knex) => {},
|
initData: async (knex) => {
|
||||||
|
await knex("o_prompt").insert([
|
||||||
|
{
|
||||||
|
name: "事件提取",
|
||||||
|
type: "eventExtraction",
|
||||||
|
data: `# 事件提取指令
|
||||||
|
|
||||||
|
你是小说文本分析助手。用户每次提供一个章节的原文,你提取该章的结构化事件信息。
|
||||||
|
|
||||||
|
## ⚠️ 输出约束(最高优先级,违反任何一条即为失败)
|
||||||
|
|
||||||
|
1. 你的**完整回复**只有一行,以 \`|\` 开头、以 \`|\` 结尾,恰好 7 个字段
|
||||||
|
2. 回复的**第一个字符**必须是 \`|\`,**最后一个字符**必须是 \`|\`
|
||||||
|
3. \`|\` 之前不许有任何字符——没有引导语、没有解释、没有"根据……"、没有"以下是……"
|
||||||
|
4. \`|\` 之后不许有任何字符——没有总结、没有提取说明、没有改编建议
|
||||||
|
5. 不输出表头行、分隔线、Markdown 标题、emoji、代码块标记
|
||||||
|
|
||||||
|
## 输出格式
|
||||||
|
|
||||||
|
\`\`\`
|
||||||
|
| 第X章 {章节标题} | {涉及角色} | {核心事件} | {主线关系} | {信息密度} | {预估集长} | {情绪强度} |
|
||||||
|
\`\`\`
|
||||||
|
|
||||||
|
### 字段规范
|
||||||
|
|
||||||
|
| 字段 | 格式要求 | 示例 |
|
||||||
|
|------|----------|------|
|
||||||
|
| 章节 | \`第X章 {章节标题}\` | \`第1章 职业危机与许愿\` |
|
||||||
|
| 涉及角色 | 有实际戏份的角色,顿号分隔 | \`林逸、白有容\` |
|
||||||
|
| 核心事件 | 30-60字,必须含动作+结果 | \`林逸因解密风潮事业崩塌,颓废中许愿触发魔法系统绑定\` |
|
||||||
|
| 主线关系 | **必须**为 \`强/中/弱(3-8字理由)\` | \`强(动机建立+系统激活)\` |
|
||||||
|
| 信息密度 | \`高\` / \`中\` / \`低\` | \`高\` |
|
||||||
|
| 预估集长 | **必须**为 \`X秒\`,禁止用分钟 | \`50秒\` |
|
||||||
|
| 情绪强度 | 文字标签,\`+\` 连接,禁止星级/数字 | \`转折+悬疑\` |
|
||||||
|
|
||||||
|
**主线关系判定**:强=直接推动主角弧线;中=补充世界观/人物关系/伏笔;弱=过渡/气氛。
|
||||||
|
|
||||||
|
**预估集长参考**:高密度+高情绪→45-60秒;中→35-45秒;低→25-35秒。
|
||||||
|
|
||||||
|
**可用情绪标签**:\`冲突\`、\`恐怖\`、\`情感\`、\`转折\`、\`高潮\`、\`平铺\`、\`喜剧\`、\`悬疑\`、\`情感崩溃\`。
|
||||||
|
|
||||||
|
## 输出示例
|
||||||
|
|
||||||
|
以下两个示例展示的是**完整回复**——除这一行外没有任何其他内容:
|
||||||
|
|
||||||
|
\`\`\`
|
||||||
|
| 第1章 职业危机与许愿 | 林逸 | 职业魔术师林逸因解密打假风潮导致事业崩塌,颓废中感慨"如果会魔法就好了",意外触发神奇魔法系统绑定 | 强(主角动机建立+系统激活) | 高 | 50秒 | 转折+悬疑 |
|
||||||
|
\`\`\`
|
||||||
|
\`\`\`
|
||||||
|
| 第12章 山间小憩 | 凌玄、苏晚卿 | 凌玄与苏晚卿在山间歇脚,苏晚卿回忆幼时往事,两人关系略有缓和但未实质推进 | 弱(气氛过渡) | 低 | 25秒 | 平铺+情感 |
|
||||||
|
\`\`\`
|
||||||
|
|
||||||
|
## 提取规则
|
||||||
|
|
||||||
|
- 忠于原文,不推测、不脑补、不加入原文未出现的情节
|
||||||
|
- 角色使用文中主要称呼,保持一致
|
||||||
|
- 多条平行事件线时,选对主角影响最大的一条,其余简要带过
|
||||||
|
- 对话密集章节,关注对话推动了什么结果,而非复述对话内容`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "资产提示词生成",
|
||||||
|
type: "assetsPromptGeneration",
|
||||||
|
data: "# 资产提示词生成指令 根据提供的项目参数和资产设定,生成符合要求的提示词\n\n请根据以下参数生成提示词:\n\n**基础参数:**\n- 风格: {风格}\n- 小说类型: {小说类型}\n- 小说背景: {小说背景}\n\n**资产设定:**\n- 类型: {角色/场景/道具}\n- 名称:{名称}\n- 描述:{描述}\n\n请严格按照skill规范生成提示词。",
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
//小说原文表
|
//小说原文表
|
||||||
{
|
{
|
||||||
@ -436,6 +501,368 @@ export default async (knex: Knex, forceInit: boolean = false): Promise<void> =>
|
|||||||
table.unique(["scriptId", "assetId"]);
|
table.unique(["scriptId", "assetId"]);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "o_skillList",
|
||||||
|
builder: (table) => {
|
||||||
|
table.text("id").notNullable();
|
||||||
|
table.text("md5").notNullable();
|
||||||
|
table.text("path").notNullable();
|
||||||
|
table.text("name").notNullable(); //文件名
|
||||||
|
table.text("description").notNullable(); //描述
|
||||||
|
table.text("embedding"); // 向量嵌入 JSON
|
||||||
|
table.text("type").notNullable(); // "main" | "references"
|
||||||
|
table.integer("createTime").notNullable();
|
||||||
|
table.integer("updateTime").notNullable();
|
||||||
|
table.integer("state").notNullable(); // 1正常,0正在生成description,-1description为空。-2归属为空,-3md5变动,-4文件不存在
|
||||||
|
table.primary(["id"]);
|
||||||
|
},
|
||||||
|
initData: async (knex) => {
|
||||||
|
const list = [
|
||||||
|
{
|
||||||
|
id: "4fb36012e56e395b425569987f5dab0e",
|
||||||
|
md5: "fca3c269c5f325a65dafa663c9bb9773",
|
||||||
|
path: "production_agent_decision.md",
|
||||||
|
name: "production_agent_decision",
|
||||||
|
description: "",
|
||||||
|
embedding: "",
|
||||||
|
type: "main",
|
||||||
|
createTime: 1774447310118,
|
||||||
|
updateTime: 1774447310118,
|
||||||
|
state: -1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "017b6338d7aa227cd614ec1fb25fd83e",
|
||||||
|
md5: "2610b80abe4bd048fe61c73adc7388ac",
|
||||||
|
path: "production_agent_execution.md",
|
||||||
|
name: "production_agent_execution",
|
||||||
|
description: "",
|
||||||
|
embedding: "",
|
||||||
|
type: "main",
|
||||||
|
createTime: 1774447310118,
|
||||||
|
updateTime: 1774447310118,
|
||||||
|
state: -1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "f03c8e67b61580de9ea5b9d166521b67",
|
||||||
|
md5: "d41d8cd98f00b204e9800998ecf8427e",
|
||||||
|
path: "production_agent_supervision.md",
|
||||||
|
name: "production_agent_supervision",
|
||||||
|
description: "",
|
||||||
|
embedding: "",
|
||||||
|
type: "main",
|
||||||
|
createTime: 1774447310118,
|
||||||
|
updateTime: 1774447310118,
|
||||||
|
state: -1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "50b49d8af5d364665b463c23f6a4d8bb",
|
||||||
|
md5: "fbba66e0df2426996277b299710c3033",
|
||||||
|
path: "script_agent_decision.md",
|
||||||
|
name: "script_agent_decision",
|
||||||
|
description: "",
|
||||||
|
embedding: "",
|
||||||
|
type: "main",
|
||||||
|
createTime: 1774447310118,
|
||||||
|
updateTime: 1774447310118,
|
||||||
|
state: -1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "427727727e1095c54b6840cd21382d82",
|
||||||
|
md5: "7e5911242af7233854d533278c6a8ccb",
|
||||||
|
path: "script_agent_execution.md",
|
||||||
|
name: "script_agent_execution",
|
||||||
|
description: "",
|
||||||
|
embedding: "",
|
||||||
|
type: "main",
|
||||||
|
createTime: 1774447310118,
|
||||||
|
updateTime: 1774447310118,
|
||||||
|
state: -1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "02848fb0dd582fd926502c77ecf9679c",
|
||||||
|
md5: "7a8b6a311b015cd47bf17cc52b935348",
|
||||||
|
path: "script_agent_supervision.md",
|
||||||
|
name: "script_agent_supervision",
|
||||||
|
description: "",
|
||||||
|
embedding: "",
|
||||||
|
type: "main",
|
||||||
|
createTime: 1774447310118,
|
||||||
|
updateTime: 1774447310118,
|
||||||
|
state: -1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "a1e818cc03a0b355b239ac1fb0512969",
|
||||||
|
md5: "1fd22029e8047aa30b0dfd703cb837ed",
|
||||||
|
path: "universal_agent.md",
|
||||||
|
name: "universal_agent",
|
||||||
|
description: "",
|
||||||
|
embedding: "",
|
||||||
|
type: "main",
|
||||||
|
createTime: 1774447310118,
|
||||||
|
updateTime: 1774447310118,
|
||||||
|
state: -1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "3e5efec258c8d8e6a39bcef12f8ee058",
|
||||||
|
md5: "efccb0464cfd472861b49ebf737d4820",
|
||||||
|
path: "references/event_extract.md",
|
||||||
|
name: "event_extract",
|
||||||
|
description:
|
||||||
|
"专为小说改编短剧设计的文本分析助手,逐章提取涉及角色、核心事件、主线关系、信息密度、预估集长及情绪强度等结构化信息,以Markdown表格形式输出,并附汇总统计,辅助短剧制作的内容规划与时长估算。",
|
||||||
|
embedding: "",
|
||||||
|
type: "references",
|
||||||
|
createTime: 1774447310118,
|
||||||
|
updateTime: 1774450165911,
|
||||||
|
state: 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "52c51fa8655f899a1b7aae9b6aad7251",
|
||||||
|
md5: "783678aaab829b34e7c30a414c356bf6",
|
||||||
|
path: "references/novel_character_extract.md",
|
||||||
|
name: "novel_character_extract",
|
||||||
|
description:
|
||||||
|
"专为小说内容分析设计的角色提取助手,从原文中识别并结构化输出所有重要角色的视觉描述信息,包括外貌、服饰、体态、状态变体等字段,供美术制作和AI角色图生成使用。",
|
||||||
|
embedding: "",
|
||||||
|
type: "references",
|
||||||
|
createTime: 1774447310118,
|
||||||
|
updateTime: 1774450080903,
|
||||||
|
state: 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "6d46cdca10b2f49e07e515885d1387a0",
|
||||||
|
md5: "10544d12c4ef011e6b3b63a99b8c7fa8",
|
||||||
|
path: "references/novel_props_extract.md",
|
||||||
|
name: "novel_props_extract",
|
||||||
|
description:
|
||||||
|
"专注于从小说原文中提取道具物品信息的分析助手,能识别武器、法器、药物等各类道具,生成包含外观、材质、尺寸、功能及状态变体的结构化视觉描述表格,供美术制作和AI绘图使用。",
|
||||||
|
embedding: "",
|
||||||
|
type: "references",
|
||||||
|
createTime: 1774447310118,
|
||||||
|
updateTime: 1774450094771,
|
||||||
|
state: 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "1864df75d1d65f76e275046649ecaef8",
|
||||||
|
md5: "65603aa495a541f54c55b7f30e149f45",
|
||||||
|
path: "references/novel_scene_extract.md",
|
||||||
|
name: "novel_scene_extract",
|
||||||
|
description:
|
||||||
|
"专注于从小说原文中提取并结构化场景信息的分析助手,可识别各类场景地点,输出包含空间描述、光照氛围、关键陈设、色调基调等字段的标准化场景资产表,用于美术制作和AI绘图的场景概念图生成。",
|
||||||
|
embedding: "",
|
||||||
|
type: "references",
|
||||||
|
createTime: 1774447310118,
|
||||||
|
updateTime: 1774450161878,
|
||||||
|
state: 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "7fbce6f90d7d85496ba9817e9622e640",
|
||||||
|
md5: "830559e8f2cd5d0fa8e6df48a164fe2d",
|
||||||
|
path: "references/video_dialogue_extract.md",
|
||||||
|
name: "video_dialogue_extract",
|
||||||
|
description:
|
||||||
|
"这是一个专门从视频分镜提示词中提取结构化台词、旁白与音效信息的AI助手配置文档,定义了完整的输出格式(含镜号、角色、台词类型、表演指导等字段)、提取规则及处理流程,用于将视频分镜描述转化为标准化台词表。",
|
||||||
|
embedding: "",
|
||||||
|
type: "references",
|
||||||
|
createTime: 1774447310118,
|
||||||
|
updateTime: 1774450180712,
|
||||||
|
state: 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "31fb5c5a1f514ec1e66b4eba9f22d4db",
|
||||||
|
md5: "43e63450efe0c9af8a3a40b036d36cb4",
|
||||||
|
path: "references/pipeline.md",
|
||||||
|
name: "pipeline",
|
||||||
|
description:
|
||||||
|
"面向短剧改编项目的四阶段流水线说明文档,涵盖事件提取、故事骨架、改编策略、剧本编写的串行执行流程,定义了决策层、执行层、监督层的协作规范及派发、审核、修复的交互格式与质量门控标准。",
|
||||||
|
embedding: "",
|
||||||
|
type: "references",
|
||||||
|
createTime: 1774451946248,
|
||||||
|
updateTime: 1774451984533,
|
||||||
|
state: 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "27dc2dfc901de2180227d0269217583a",
|
||||||
|
md5: "7d353be4bab7a794436d9abff2b9c6ee",
|
||||||
|
path: "references/adaptation_format.md",
|
||||||
|
name: "adaptation_format",
|
||||||
|
description:
|
||||||
|
"本文档规定了改编策略输出的标准格式,包括核心改编原则、删除决策和世界观呈现策略三大模块的书写规范,明确各模块所需涵盖的维度与要素,用于指导竖屏短剧等载体的文学改编工作。",
|
||||||
|
embedding: "",
|
||||||
|
type: "references",
|
||||||
|
createTime: 1774452010535,
|
||||||
|
updateTime: 1774452022083,
|
||||||
|
state: 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "d49fa09504fe784a8e6eb102756c6d56",
|
||||||
|
md5: "2ef08a7479f29d74986999ceb02092c8",
|
||||||
|
path: "references/event_format.md",
|
||||||
|
name: "event_format",
|
||||||
|
description:
|
||||||
|
"本文档规定了影视改编项目中事件表的标准输出格式,包括文件头、事件表格、各字段填写规范(章节、角色、核心事件、主线关系、情绪强度、预估时长)及汇总统计模板,用于指导从原著提取事件并评估改编集数与压缩比的第一阶段工作。",
|
||||||
|
embedding: "",
|
||||||
|
type: "references",
|
||||||
|
createTime: 1774452010535,
|
||||||
|
updateTime: 1774452030858,
|
||||||
|
state: 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "797906c2ddf0750f050bcdeae23eae3d",
|
||||||
|
md5: "f5e7fe6db7e05db69d5dc327c4c538f2",
|
||||||
|
path: "references/script_format.md",
|
||||||
|
name: "script_format",
|
||||||
|
description:
|
||||||
|
"本文档为竖屏短剧剧本的输出格式规范,定义了文件头、节拍结构、分镜脚本、画面描述、台词、转场标注等标准格式要求,并附有时长控制参数与自查清单,供AI视频生成和导演制作使用。",
|
||||||
|
embedding: "",
|
||||||
|
type: "references",
|
||||||
|
createTime: 1774452010535,
|
||||||
|
updateTime: 1774452042934,
|
||||||
|
state: 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "1abd8675c0c3e62b20c0b151d2ec0fb1",
|
||||||
|
md5: "a587532c737ce15022e1522021f099bb",
|
||||||
|
path: "references/skeleton_format.md",
|
||||||
|
name: "skeleton_format",
|
||||||
|
description:
|
||||||
|
"本文档定义了故事骨架文件(skeleton.md)的标准化输出格式,涵盖故事核、人物成长隐线、三幕结构、分集决策模板、全局删减记录、付费卡点设计及自查清单,用于指导编剧将章节事件列表转化为结构完整的剧集改编方案。",
|
||||||
|
embedding: "",
|
||||||
|
type: "references",
|
||||||
|
createTime: 1774452010535,
|
||||||
|
updateTime: 1774452057184,
|
||||||
|
state: 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "0b7828d7a6ab458a4b201122f08d6c16",
|
||||||
|
md5: "120b3c856f1b2a8a429e11319e8c95fe",
|
||||||
|
path: "references/quality_criteria.md",
|
||||||
|
name: "quality_criteria",
|
||||||
|
description:
|
||||||
|
"本文档为影视/短剧项目的质量审核标准手册,涵盖事件表、故事骨架、改编策略和剧本四大模块的详细审核规则,规定了格式规范、角色名称统一、时长合理性、画面可执行性及场景氛围一致性等审核要求,用于确保各阶段产出物的内容准确性与制作可行性。",
|
||||||
|
embedding: "",
|
||||||
|
type: "references",
|
||||||
|
createTime: 1774452068093,
|
||||||
|
updateTime: 1774452087877,
|
||||||
|
state: 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "5c1772b5f9c420d9eae9ca02914ba087",
|
||||||
|
md5: "c710ab7d237e1f0c5aa3d208e0f5b484",
|
||||||
|
path: "references/plan.md",
|
||||||
|
name: "plan",
|
||||||
|
description:
|
||||||
|
"该文档定义了AI代理生成执行计划的规范,包括任务总览、步骤列表(含编号、名称、详细内容、预期输出及依赖关系)和执行顺序标注,并提供标准回复模板,用于将用户需求拆解为可直接传入子代理工具执行的具体步骤。",
|
||||||
|
embedding: "",
|
||||||
|
type: "references",
|
||||||
|
createTime: 1774452098447,
|
||||||
|
updateTime: 1774452109574,
|
||||||
|
state: 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "75a45cf996015ca819582873887ec301",
|
||||||
|
md5: "6045d76873fd58b8b87a914a21a38439",
|
||||||
|
path: "references/derive_assets_extraction.md",
|
||||||
|
name: "derive_assets_extraction",
|
||||||
|
description:
|
||||||
|
"本文档是一份技术操作指南,说明如何根据剧本内容和已有资产列表,提取每个资产在剧情中出现的不同视觉状态变体(derive),并通过工具函数读取和写入数据,用于后续图片生成参考。",
|
||||||
|
embedding: "",
|
||||||
|
type: "references",
|
||||||
|
createTime: 1774452119499,
|
||||||
|
updateTime: 1774452129516,
|
||||||
|
state: 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "fce75f69d704c19bebcb356bc1bd6e81",
|
||||||
|
md5: "a3b3432854970f22949ba47236a6532f",
|
||||||
|
path: "references/storyboard_generation.md",
|
||||||
|
name: "storyboard_generation",
|
||||||
|
description:
|
||||||
|
"根据剧本和资产列表生成结构化分镜面板的工具指南,涵盖分镜拆分原则、字段填写规范及工具调用流程,用于将剧本转化为含画面描述、镜头语言、台词和AI绘图提示词的分镜数据。",
|
||||||
|
embedding: "",
|
||||||
|
type: "references",
|
||||||
|
createTime: 1774452119499,
|
||||||
|
updateTime: 1774452140873,
|
||||||
|
state: 1,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
await Promise.all(
|
||||||
|
list.map(async (item) => {
|
||||||
|
const embedding = await getEmbedding(item.description);
|
||||||
|
item.embedding = JSON.stringify(embedding);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
await knex("o_skillList").insert(list);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "o_skillAttribution",
|
||||||
|
builder: (table) => {
|
||||||
|
table.text("skillId").notNullable().references("id").inTable("o_skillList").onDelete("CASCADE");
|
||||||
|
table.text("attribution").notNullable(); // "production_agent_decision.md" | "production_agent_execution.md" | "production_agent_supervision.md" | "script_agent_decision.md" | "script_agent_execution.md" | "script_agent_supervision.md" | "universal_agent.md"
|
||||||
|
table.primary(["skillId", "attribution"]);
|
||||||
|
table.index(["attribution"]);
|
||||||
|
},
|
||||||
|
initData: async (knex) => {
|
||||||
|
await knex("o_skillAttribution").insert([
|
||||||
|
{
|
||||||
|
skillId: "52c51fa8655f899a1b7aae9b6aad7251",
|
||||||
|
attribution: "universal_agent.md",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
skillId: "6d46cdca10b2f49e07e515885d1387a0",
|
||||||
|
attribution: "universal_agent.md",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
skillId: "1864df75d1d65f76e275046649ecaef8",
|
||||||
|
attribution: "universal_agent.md",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
skillId: "3e5efec258c8d8e6a39bcef12f8ee058",
|
||||||
|
attribution: "universal_agent.md",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
skillId: "7fbce6f90d7d85496ba9817e9622e640",
|
||||||
|
attribution: "universal_agent.md",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
skillId: "31fb5c5a1f514ec1e66b4eba9f22d4db",
|
||||||
|
attribution: "script_agent_decision.md",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
skillId: "27dc2dfc901de2180227d0269217583a",
|
||||||
|
attribution: "script_agent_execution.md",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
skillId: "d49fa09504fe784a8e6eb102756c6d56",
|
||||||
|
attribution: "script_agent_execution.md",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
skillId: "797906c2ddf0750f050bcdeae23eae3d",
|
||||||
|
attribution: "script_agent_execution.md",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
skillId: "1abd8675c0c3e62b20c0b151d2ec0fb1",
|
||||||
|
attribution: "script_agent_execution.md",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
skillId: "0b7828d7a6ab458a4b201122f08d6c16",
|
||||||
|
attribution: "script_agent_supervision.md",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
skillId: "5c1772b5f9c420d9eae9ca02914ba087",
|
||||||
|
attribution: "production_agent_decision.md",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
skillId: "75a45cf996015ca819582873887ec301",
|
||||||
|
attribution: "production_agent_execution.md",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
skillId: "fce75f69d704c19bebcb356bc1bd6e81",
|
||||||
|
attribution: "production_agent_execution.md",
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
},
|
||||||
|
},
|
||||||
//记忆表(message=原始消息, summary=压缩摘要)
|
//记忆表(message=原始消息, summary=压缩摘要)
|
||||||
{
|
{
|
||||||
name: "memories",
|
name: "memories",
|
||||||
|
|||||||
@ -4,7 +4,6 @@ import pLimit from "p-limit";
|
|||||||
import * as zod from "zod";
|
import * as zod from "zod";
|
||||||
import { error, success } from "@/lib/responseFormat";
|
import { error, success } from "@/lib/responseFormat";
|
||||||
import { validateFields } from "@/middleware/middleware";
|
import { validateFields } from "@/middleware/middleware";
|
||||||
import { useSkill } from "@/utils/agent/skillsTools";
|
|
||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
interface OutlineItem {
|
interface OutlineItem {
|
||||||
description: string;
|
description: string;
|
||||||
@ -93,7 +92,7 @@ export default router.post(
|
|||||||
|
|
||||||
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 skill = await useSkill("universal_agent.md");//todo:改为AI
|
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);
|
||||||
@ -109,7 +108,7 @@ export default router.post(
|
|||||||
|
|
||||||
findItemByName(result, item.name, config.itemType);
|
findItemByName(result, item.name, config.itemType);
|
||||||
|
|
||||||
const systemPrompt = `${skill.prompt}
|
const systemPrompt = `${data?.data}
|
||||||
|
|
||||||
请根据以下参数生成${config.label}提示词:
|
请根据以下参数生成${config.label}提示词:
|
||||||
|
|
||||||
@ -129,7 +128,6 @@ export default router.post(
|
|||||||
const { _output } = (await u.Ai.Text("universalAi").invoke({
|
const { _output } = (await u.Ai.Text("universalAi").invoke({
|
||||||
system: systemPrompt,
|
system: systemPrompt,
|
||||||
messages: [{ role: "user", content: "小说原文" + novelText }],
|
messages: [{ role: "user", content: "小说原文" + novelText }],
|
||||||
tools: skill.tools,
|
|
||||||
})) as any;
|
})) as any;
|
||||||
|
|
||||||
if (!_output) {
|
if (!_output) {
|
||||||
|
|||||||
@ -3,7 +3,6 @@ import u from "@/utils";
|
|||||||
import * as zod from "zod";
|
import * as zod from "zod";
|
||||||
import { error, success } from "@/lib/responseFormat";
|
import { error, success } from "@/lib/responseFormat";
|
||||||
import { validateFields } from "@/middleware/middleware";
|
import { validateFields } from "@/middleware/middleware";
|
||||||
import { useSkill } from "@/utils/agent/skillsTools";
|
|
||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
interface OutlineItem {
|
interface OutlineItem {
|
||||||
description: string;
|
description: string;
|
||||||
@ -99,9 +98,9 @@ export default router.post(
|
|||||||
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 skill = await useSkill("universal_agent.md");//todo:改为AI
|
const data = await u.db("o_prompt").where("type", "assetsPromptGeneration").first("data");
|
||||||
|
|
||||||
const systemPrompt = `${skill.prompt}
|
const systemPrompt = `${data?.data}
|
||||||
|
|
||||||
请根据以下参数生成${config.label}提示词:
|
请根据以下参数生成${config.label}提示词:
|
||||||
|
|
||||||
@ -121,7 +120,6 @@ export default router.post(
|
|||||||
const { _output } = (await u.Ai.Text("universalAi").invoke({
|
const { _output } = (await u.Ai.Text("universalAi").invoke({
|
||||||
system: systemPrompt,
|
system: systemPrompt,
|
||||||
messages: [{ role: "user", content: "小说原文" + novelText }],
|
messages: [{ role: "user", content: "小说原文" + novelText }],
|
||||||
tools: skill.tools,
|
|
||||||
})) as any;
|
})) as any;
|
||||||
|
|
||||||
if (!_output) return res.status(500).send("失败");
|
if (!_output) return res.status(500).send("失败");
|
||||||
|
|||||||
@ -12,12 +12,9 @@ export default router.post(
|
|||||||
}),
|
}),
|
||||||
async (req, res) => {
|
async (req, res) => {
|
||||||
const { id, data } = req.body;
|
const { id, data } = req.body;
|
||||||
await u
|
await u.db("o_prompt").where("id", id).update({
|
||||||
.db("o_prompt")
|
data,
|
||||||
.where("id", id)
|
});
|
||||||
.update({
|
|
||||||
data: JSON.stringify(data),
|
|
||||||
});
|
|
||||||
res.status(200).send(success(123));
|
res.status(200).send(success(123));
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
36
src/types/database.d.ts
vendored
36
src/types/database.d.ts
vendored
@ -1,6 +1,19 @@
|
|||||||
// @db-hash dd33f188acbdc629e015ba7017c20c78
|
// @db-hash e24c7c99757472b92af11f26a2b2b8c7
|
||||||
//该文件由脚本自动生成,请勿手动修改
|
//该文件由脚本自动生成,请勿手动修改
|
||||||
|
|
||||||
|
export interface _o_project_old_20260328 {
|
||||||
|
'artStyle'?: string | null;
|
||||||
|
'createTime'?: number | null;
|
||||||
|
'id'?: number | null;
|
||||||
|
'imageModel'?: string | null;
|
||||||
|
'intro'?: string | null;
|
||||||
|
'name'?: string | 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;
|
||||||
'createTime': number;
|
'createTime': number;
|
||||||
@ -21,7 +34,7 @@ export interface o_agentDeploy {
|
|||||||
'model'?: string | null;
|
'model'?: string | null;
|
||||||
'modelName'?: string | null;
|
'modelName'?: string | null;
|
||||||
'name'?: string | null;
|
'name'?: string | null;
|
||||||
'vendorId'?: string | null;
|
'vendorId'?: number | null;
|
||||||
}
|
}
|
||||||
export interface o_agentWorkData {
|
export interface o_agentWorkData {
|
||||||
'createTime'?: number | null;
|
'createTime'?: number | null;
|
||||||
@ -143,6 +156,22 @@ export interface o_setting {
|
|||||||
'key'?: string | null;
|
'key'?: string | null;
|
||||||
'value'?: string | null;
|
'value'?: string | null;
|
||||||
}
|
}
|
||||||
|
export interface o_skillAttribution {
|
||||||
|
'attribution'?: string;
|
||||||
|
'skillId'?: string;
|
||||||
|
}
|
||||||
|
export interface o_skillList {
|
||||||
|
'createTime': number;
|
||||||
|
'description': string;
|
||||||
|
'embedding'?: string | null;
|
||||||
|
'id'?: string;
|
||||||
|
'md5': string;
|
||||||
|
'name': string;
|
||||||
|
'path': string;
|
||||||
|
'state': number;
|
||||||
|
'type': string;
|
||||||
|
'updateTime': number;
|
||||||
|
}
|
||||||
export interface o_storyboard {
|
export interface o_storyboard {
|
||||||
'camera'?: string | null;
|
'camera'?: string | null;
|
||||||
'createTime'?: number | null;
|
'createTime'?: number | null;
|
||||||
@ -216,6 +245,7 @@ export interface o_videoConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface DB {
|
export interface DB {
|
||||||
|
"_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;
|
||||||
@ -234,6 +264,8 @@ export interface DB {
|
|||||||
"o_script": o_script;
|
"o_script": o_script;
|
||||||
"o_scriptAssets": o_scriptAssets;
|
"o_scriptAssets": o_scriptAssets;
|
||||||
"o_setting": o_setting;
|
"o_setting": o_setting;
|
||||||
|
"o_skillAttribution": o_skillAttribution;
|
||||||
|
"o_skillList": o_skillList;
|
||||||
"o_storyboard": o_storyboard;
|
"o_storyboard": o_storyboard;
|
||||||
"o_tasks": o_tasks;
|
"o_tasks": o_tasks;
|
||||||
"o_user": o_user;
|
"o_user": o_user;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user