接入测试

This commit is contained in:
zhishi 2026-03-15 19:39:23 +08:00
parent 6b85599c2e
commit c10323881c
14 changed files with 582 additions and 312 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "toonflow-app", "name": "toonflow-app",
"version": "1.0.7-patch2", "version": "1.0.7-patch3",
"description": "Toonflow 是一款 AI 短剧漫剧工具,能够利用 AI 技术将小说自动转化为剧本,并结合 AI 生成的图片和视频,实现高效的短剧创作。", "description": "Toonflow 是一款 AI 短剧漫剧工具,能够利用 AI 技术将小说自动转化为剧本,并结合 AI 生成的图片和视频,实现高效的短剧创作。",
"author": "HBAI-Ltd <ltlctools@outlook.com>", "author": "HBAI-Ltd <ltlctools@outlook.com>",
"homepage": "https://github.com/HBAI-Ltd/Toonflow-app#readme", "homepage": "https://github.com/HBAI-Ltd/Toonflow-app#readme",

File diff suppressed because one or more lines are too long

View File

@ -65,7 +65,7 @@ export default async (knex: Knex): Promise<void> => {
await knex("t_prompts") await knex("t_prompts")
.update({ .update({
defaultValue: defaultValue:
'请根据以下参数生成标准场景参考图:\n**用户提供的参数:**\n- 场景名称:[用户填写]\n- 场景描述:[用户填写详细的场景提示词]\n- 画风风格:[用户填写艺术风格描述]\n---\n[核心要求]\n根据用户提供的场景描述绘制场景/环境。重要:场景必须完全空旷,不得出现任何人物、角色、人形轮廓或剪影。\n[艺术风格]\n严格按照用户提供的画风风格进行渲染。输出必须清晰体现该艺术风格不得输出普通照片或未经处理的写实图像。\n[布局规范 — 严格遵守]\n整个图像由一条从上到下的实线黑色竖线分为左右两半。\n左侧区域占40%宽度):\n- 场景的高细节广角全景图,展示整体建筑、比例、光照和氛围\n- 绝对不得出现人物或角色\n- 右侧边缘有一条实线黑色竖线,将其与右侧分隔\n右侧区域占60%宽度):\n 同一场景的三个不同视角:\n 1) 鸟瞰俯视图,展示完整布局\n 2) 平视角度的另一视角\n 3) 关键区域或焦点的特写细节图\n 三个视图必须描绘同一地点,保持一致的光照和色彩。所有视图均不得出现人物。整齐排列,视图之间可有或无细黑线分隔。\n \n[关键布局规则]\n1. 必须有一条实线黑色竖线分隔左右两半\n[质量与约束]\n- 高分辨率,所有视图的细节和色彩保持一致,纯白色背景\n- 图像中不得有其他文字、标签、标题、水印或签名\n- 不得添加任何UI元素、注释覆盖层或额外标签\n- 保持所有插图视图简洁。让视觉效果自己说话\n请严格按照系统规范生成标准场景图。' "请根据以下参数生成标准场景参考图:\n**用户提供的参数:**\n- 场景名称:[用户填写]\n- 场景描述:[用户填写详细的场景提示词]\n- 画风风格:[用户填写艺术风格描述]\n---\n[核心要求]\n根据用户提供的场景描述绘制场景/环境。重要:场景必须完全空旷,不得出现任何人物、角色、人形轮廓或剪影。\n[艺术风格]\n严格按照用户提供的画风风格进行渲染。输出必须清晰体现该艺术风格不得输出普通照片或未经处理的写实图像。\n[布局规范 — 严格遵守]\n整个图像由一条从上到下的实线黑色竖线分为左右两半。\n左侧区域占40%宽度):\n- 场景的高细节广角全景图,展示整体建筑、比例、光照和氛围\n- 绝对不得出现人物或角色\n- 右侧边缘有一条实线黑色竖线,将其与右侧分隔\n右侧区域占60%宽度):\n 同一场景的三个不同视角:\n 1) 鸟瞰俯视图,展示完整布局\n 2) 平视角度的另一视角\n 3) 关键区域或焦点的特写细节图\n 三个视图必须描绘同一地点,保持一致的光照和色彩。所有视图均不得出现人物。整齐排列,视图之间可有或无细黑线分隔。\n \n[关键布局规则]\n1. 必须有一条实线黑色竖线分隔左右两半\n[质量与约束]\n- 高分辨率,所有视图的细节和色彩保持一致,纯白色背景\n- 图像中不得有其他文字、标签、标题、水印或签名\n- 不得添加任何UI元素、注释覆盖层或额外标签\n- 保持所有插图视图简洁。让视觉效果自己说话\n请严格按照系统规范生成标准场景图。",
}) })
.where("code", "scene-generateImage"); .where("code", "scene-generateImage");
const videoText = await knex("t_prompts").where("code", "video-text").first(); const videoText = await knex("t_prompts").where("code", "video-text").first();
@ -104,4 +104,149 @@ export default async (knex: Knex): Promise<void> => {
if (needInsert.length) { if (needInsert.length) {
await knex("t_aiModelMap").insert(needInsert); await knex("t_aiModelMap").insert(needInsert);
} }
const checkVideoModel = await knex("t_videoModel").where("manufacturer", "formal").where("model", "Sora-2-I2V").first();
if (!checkVideoModel) {
await knex("t_videoModel").where("manufacturer", "formal").delete();
await knex("t_videoModel").insert([
{
manufacturer: "formal",
model: "Seedance-1.5-Pro-audio",
durationResolutionMap: JSON.stringify([{ duration: [4, 5, 6, 7, 8, 9, 10, 11, 12], resolution: ["480p", "720p", "1080p"] }]),
aspectRatio: JSON.stringify(["16:9", "9:16"]),
audio: 0,
type: JSON.stringify(["endFrameOptional"]),
},
{
manufacturer: "formal",
model: "Seedance-1.5-Pro-NotAudio",
durationResolutionMap: JSON.stringify([{ duration: [4, 5, 6, 7, 8, 9, 10, 11, 12], resolution: ["480p", "720p", "1080p"] }]),
aspectRatio: JSON.stringify(["16:9", "9:16"]),
audio: 0,
type: JSON.stringify(["endFrameOptional"]),
},
{
manufacturer: "formal",
model: "Seedance-1.0-Pro",
durationResolutionMap: JSON.stringify([{ duration: [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], resolution: ["480p", "720p", "1080p"] }]),
aspectRatio: JSON.stringify(["16:9", "9:16"]),
audio: 0,
type: JSON.stringify(["endFrameOptional"]),
},
{
manufacturer: "formal",
model: "ViduQ3-turbo",
durationResolutionMap: JSON.stringify([
{ duration: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], resolution: ["540p", "720p", "1080p"] },
]),
aspectRatio: JSON.stringify(["16:9", "9:16", "3:4", "4:3", "1:1"]),
audio: 1,
type: JSON.stringify(["singleImage"]),
},
{
manufacturer: "formal",
model: "ViduQ3-pro",
durationResolutionMap: JSON.stringify([
{ duration: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], resolution: ["540p", "720p", "1080p"] },
]),
aspectRatio: JSON.stringify(["16:9", "9:16", "3:4", "4:3", "1:1"]),
audio: 1,
type: JSON.stringify(["singleImage"]),
},
{
manufacturer: "formal",
model: "ViduQ2-pro-fast",
durationResolutionMap: JSON.stringify([{ duration: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], resolution: ["720p", "1080p"] }]),
aspectRatio: JSON.stringify([]),
audio: 0,
type: JSON.stringify(["singleImage", "startEndRequired"]),
},
{
manufacturer: "formal",
model: "ViduQ2-pro",
durationResolutionMap: JSON.stringify([{ duration: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], resolution: ["540p", "720p", "1080p"] }]),
aspectRatio: JSON.stringify([]),
audio: 0,
type: JSON.stringify(["singleImage", "reference", "startEndRequired"]),
},
{
manufacturer: "formal",
model: "ViduQ2-turbo",
durationResolutionMap: JSON.stringify([{ duration: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], resolution: ["540p", "720p", "1080p"] }]),
aspectRatio: JSON.stringify([]),
audio: 0,
type: JSON.stringify(["singleImage", "reference", "startEndRequired"]),
},
{
manufacturer: "formal",
model: "ViduQ2",
durationResolutionMap: JSON.stringify([{ duration: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], resolution: ["540p", "720p", "1080p"] }]),
aspectRatio: JSON.stringify([]),
audio: 0,
type: JSON.stringify(["singleImage", "reference"]),
},
{
manufacturer: "formal",
model: "Sora-2-I2V",
durationResolutionMap: JSON.stringify([{ duration: [4, 8, 12], resolution: [] }]),
aspectRatio: JSON.stringify([]),
audio: 0,
type: JSON.stringify(["singleImage", "reference"]),
},
{
manufacturer: "formal",
model: "Wan2.6-I2V-720P",
durationResolutionMap: JSON.stringify([{ duration: [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], resolution: ["720p"] }]),
aspectRatio: JSON.stringify([]),
audio: 1,
type: JSON.stringify(["singleImage"]),
},
{
manufacturer: "formal",
model: "Wan2.6-I2V-720P-1080P",
durationResolutionMap: JSON.stringify([{ duration: [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], resolution: ["1080p"] }]),
aspectRatio: JSON.stringify([]),
audio: 1,
type: JSON.stringify(["singleImage"]),
},
]);
}
const checkSd2VideoModel = await knex("t_videoModel").where("manufacturer", "volcengine").where("model", "doubao-seedance-2-0-260128").first();
if (!checkSd2VideoModel) {
await knex("t_videoModel").insert([
{
manufacturer: "volcengine",
model: "doubao-seedance-2-0-260128",
durationResolutionMap: JSON.stringify([{ duration: [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], resolution: ["720p", "480p"] }]),
aspectRatio: JSON.stringify(["16:9", "4:3", "1:1", "3:4", "9:16", "21:9"]),
audio: 1,
type: JSON.stringify(["endFrameOptional", "multiImage"]),
},
]);
}
const checkImageModel = await knex("t_imageModel").where("manufacturer", "formal").where("model", "Doubao-Seedream-5.0-Lite").first();
if (!checkImageModel) {
await knex("t_imageModel").where("manufacturer", "formal").delete();
await knex("t_imageModel").insert([
{ manufacturer: "formal", model: "Doubao-Seedream-5.0-Lite", grid: 1, type: "ti2i" },
{ manufacturer: "formal", model: "doubao-seedream-4-5-251128", grid: 1, type: "ti2i" },
{ manufacturer: "formal", model: "doubao-seedream-4-0-250828", grid: 1, type: "ti2i" },
]);
}
const checkTextModel = await knex("t_imageModel").where("manufacturer", "formal").where("model", "claude-sonnet-4-6").first();
if (!checkTextModel) {
await knex("t_textModel").where("manufacturer", "formal").delete();
await knex("t_textModel").insert([
{ manufacturer: "formal", model: "gpt-4.1", responseFormat: "schema", image: 1, think: 0, tool: 1 },
{ manufacturer: "formal", model: "doubao-seed-2-0-pro-260215", responseFormat: "object", image: 0, think: 0, tool: 1 },
{ manufacturer: "formal", model: "doubao-seed-1-8-251215", responseFormat: "schema", image: 0, think: 0, tool: 1 },
{ manufacturer: "formal", model: "gpt-5.2", responseFormat: "schema", image: 1, think: 0, tool: 1 },
{ manufacturer: "formal", model: "gpt-5.1", responseFormat: "schema", image: 1, think: 0, tool: 1 },
{ manufacturer: "formal", model: "claude-sonnet-4-6", responseFormat: "schema", image: 0, think: 0, tool: 1 },
{ manufacturer: "formal", model: "claude-sonnet-4-5-20250929", responseFormat: "schema", image: 0, think: 0, tool: 1 },
{ manufacturer: "formal", model: "claude-opus-4-5-20251101", responseFormat: "schema", image: 0, think: 0, tool: 1 },
{ manufacturer: "formal", model: "qwen3.5-plus", responseFormat: "schema", image: 1, think: 0, tool: 1 },
{ manufacturer: "formal", model: "qwen3-max-2026-01-23", responseFormat: "schema", image: 1, think: 0, tool: 1 },
]);
}
}; };

View File

@ -591,54 +591,38 @@ export default async (knex: Knex, forceInit: boolean = false): Promise<void> =>
{ manufacturer: "deepSeek", model: "deepseek-chat", responseFormat: "schema", image: 0, think: 0, tool: 1 }, { manufacturer: "deepSeek", model: "deepseek-chat", responseFormat: "schema", image: 0, think: 0, tool: 1 },
{ manufacturer: "deepSeek", model: "deepseek-reasoner", responseFormat: "schema", image: 0, think: 1, tool: 1 }, { manufacturer: "deepSeek", model: "deepseek-reasoner", responseFormat: "schema", image: 0, think: 1, tool: 1 },
{ manufacturer: "volcengine", model: "doubao-seed-2-0-pro-260215", responseFormat: "object", image: 1, think: 1, tool: 1 }, { manufacturer: "volcengine", model: "doubao-seed-2-0-pro-260215", responseFormat: "object", image: 1, think: 1, tool: 1 },
// { manufacturer: "volcengine", model: "doubao-seed-2-0-lite-260215", responseFormat: "object", image: 1, think: 1, tool: 1 },
// { manufacturer: "volcengine", model: "doubao-seed-2-0-mini-260215", responseFormat: "object", image: 1, think: 1, tool: 1 },
{ manufacturer: "volcengine", model: "doubao-seed-1-8-251228", responseFormat: "schema", image: 1, think: 1, tool: 1 }, { manufacturer: "volcengine", model: "doubao-seed-1-8-251228", responseFormat: "schema", image: 1, think: 1, tool: 1 },
// { manufacturer: "volcengine", model: "doubao-seed-1-6-251015", responseFormat: "schema", image: 1, think: 1, tool: 1 },
// { manufacturer: "volcengine", model: "doubao-seed-1-6-lite-251015", responseFormat: "schema", image: 1, think: 1, tool: 1 },
// { manufacturer: "volcengine", model: "doubao-seed-1-6-flash-250828", responseFormat: "schema", image: 1, think: 1, tool: 1 },
{ manufacturer: "zhipu", model: "glm-4.7", responseFormat: "object", image: 0, think: 0, tool: 1 }, { manufacturer: "zhipu", model: "glm-4.7", responseFormat: "object", image: 0, think: 0, tool: 1 },
// { manufacturer: "zhipu", model: "glm-4.7-flashx", responseFormat: "object", image: 0, think: 0, tool: 1 },
{ manufacturer: "zhipu", model: "glm-4.6", responseFormat: "object", image: 0, think: 0, tool: 1 }, { manufacturer: "zhipu", model: "glm-4.6", responseFormat: "object", image: 0, think: 0, tool: 1 },
// { manufacturer: "zhipu", model: "glm-4.5-air", responseFormat: "object", image: 0, think: 0, tool: 1 },
// { manufacturer: "zhipu", model: "glm-4.5-airx", responseFormat: "object", image: 0, think: 0, tool: 1 },
// { manufacturer: "zhipu", model: "glm-4-long", responseFormat: "object", image: 0, think: 0, tool: 1 },
// { manufacturer: "zhipu", model: "glm-4-flashx-250414", responseFormat: "object", image: 0, think: 0, tool: 1 },
{ manufacturer: "zhipu", model: "glm-4.7-flash", responseFormat: "object", image: 0, think: 0, tool: 1 }, { manufacturer: "zhipu", model: "glm-4.7-flash", responseFormat: "object", image: 0, think: 0, tool: 1 },
// { manufacturer: "zhipu", model: "glm-4.5-flash", responseFormat: "object", image: 0, think: 1, tool: 1 },
// { manufacturer: "zhipu", model: "glm-4-flash-250414", responseFormat: "object", image: 0, think: 0, tool: 1 },
{ manufacturer: "zhipu", model: "glm-4.6v", responseFormat: "object", image: 1, think: 1, tool: 1 }, { manufacturer: "zhipu", model: "glm-4.6v", responseFormat: "object", image: 1, think: 1, tool: 1 },
{ manufacturer: "qwen", model: "qwen-vl-max", responseFormat: "schema", image: 1, think: 0, tool: 1 }, { manufacturer: "qwen", model: "qwen-vl-max", responseFormat: "schema", image: 1, think: 0, tool: 1 },
{ manufacturer: "qwen", model: "qwen-plus-latest", responseFormat: "schema", image: 0, think: 0, tool: 1 }, { manufacturer: "qwen", model: "qwen-plus-latest", responseFormat: "schema", image: 0, think: 0, tool: 1 },
{ manufacturer: "qwen", model: "qwen-max", responseFormat: "schema", image: 0, think: 0, tool: 1 }, { manufacturer: "qwen", model: "qwen-max", responseFormat: "schema", image: 0, think: 0, tool: 1 },
// { manufacturer: "qwen", model: "qwen2.5-72b-instruct", responseFormat: "schema", image: 0, think: 0, tool: 1 },
// { manufacturer: "qwen", model: "qwen2.5-14b-instruct-1m", responseFormat: "schema", image: 0, think: 0, tool: 1 },
// { manufacturer: "qwen", model: "qwen2.5-vl-72b-instruct", responseFormat: "schema", image: 1, think: 0, tool: 1 },
// { manufacturer: "openai", model: "gpt-4o", responseFormat: "schema", image: 1, think: 0, tool: 1 },
// { manufacturer: "openai", model: "gpt-4o-mini", responseFormat: "schema", image: 1, think: 0, tool: 1 },
{ manufacturer: "openai", model: "gpt-4.1", responseFormat: "schema", image: 1, think: 0, tool: 1 }, { manufacturer: "openai", model: "gpt-4.1", responseFormat: "schema", image: 1, think: 0, tool: 1 },
// { manufacturer: "openai", model: "gpt-5.1", responseFormat: "schema", image: 1, think: 0, tool: 1 },
{ manufacturer: "openai", model: "gpt-5.2", responseFormat: "schema", image: 1, think: 0, tool: 1 }, { manufacturer: "openai", model: "gpt-5.2", responseFormat: "schema", image: 1, think: 0, tool: 1 },
{ manufacturer: "gemini", model: "gemini-3-pro-preview", responseFormat: "schema", image: 1, think: 1, tool: 1 }, { manufacturer: "gemini", model: "gemini-3-pro-preview", responseFormat: "schema", image: 1, think: 1, tool: 1 },
{ manufacturer: "gemini", model: "gemini-2.5-pro", responseFormat: "schema", image: 1, think: 1, tool: 1 }, { manufacturer: "gemini", model: "gemini-2.5-pro", responseFormat: "schema", image: 1, think: 1, tool: 1 },
// { manufacturer: "gemini", model: "gemini-2.5-flash", responseFormat: "schema", image: 1, think: 1, tool: 1 },
// { manufacturer: "gemini", model: "gemini-2.0-flash", responseFormat: "schema", image: 1, think: 0, tool: 1 },
// { manufacturer: "gemini", model: "gemini-2.0-flash-lite", responseFormat: "schema", image: 1, think: 0, tool: 1 },
// { manufacturer: "gemini", model: "gemini-1.5-pro", responseFormat: "schema", image: 1, think: 0, tool: 1 },
// { manufacturer: "gemini", model: "gemini-1.5-flash", responseFormat: "schema", image: 1, think: 0, tool: 1 },
{ manufacturer: "anthropic", model: "claude-opus-4-5", responseFormat: "schema", image: 1, think: 0, tool: 1 }, { manufacturer: "anthropic", model: "claude-opus-4-5", responseFormat: "schema", image: 1, think: 0, tool: 1 },
{ manufacturer: "anthropic", model: "claude-haiku-4-5", responseFormat: "schema", image: 1, think: 0, tool: 1 }, { manufacturer: "anthropic", model: "claude-haiku-4-5", responseFormat: "schema", image: 1, think: 0, tool: 1 },
{ manufacturer: "anthropic", model: "claude-sonnet-4-5", responseFormat: "schema", image: 1, think: 0, tool: 1 }, { manufacturer: "anthropic", model: "claude-sonnet-4-5", responseFormat: "schema", image: 1, think: 0, tool: 1 },
{ manufacturer: "anthropic", model: "claude-opus-4-1", responseFormat: "schema", image: 1, think: 0, tool: 1 }, { manufacturer: "anthropic", model: "claude-opus-4-1", responseFormat: "schema", image: 1, think: 0, tool: 1 },
// { manufacturer: "anthropic", model: "claude-opus-4-0", responseFormat: "schema", image: 1, think: 0, tool: 1 },
// { manufacturer: "anthropic", model: "claude-sonnet-4-0", responseFormat: "schema", image: 1, think: 0, tool: 1 },
// { manufacturer: "anthropic", model: "claude-3-7-sonnet-latest", responseFormat: "schema", image: 1, think: 0, tool: 1 },
// { manufacturer: "anthropic", model: "claude-3-5-haiku-latest", responseFormat: "schema", image: 1, think: 0, tool: 1 },
{ manufacturer: "xai", model: "grok-3", responseFormat: "schema", image: 0, think: 0, tool: 1 }, { manufacturer: "xai", model: "grok-3", responseFormat: "schema", image: 0, think: 0, tool: 1 },
{ manufacturer: "xai", model: "grok-4", responseFormat: "schema", image: 0, think: 0, tool: 1 }, { manufacturer: "xai", model: "grok-4", responseFormat: "schema", image: 0, think: 0, tool: 1 },
{ manufacturer: "xai", model: "grok-4.1", responseFormat: "schema", image: 1, think: 0, tool: 1 }, { manufacturer: "xai", model: "grok-4.1", responseFormat: "schema", image: 1, think: 0, tool: 1 },
{ manufacturer: "other", model: "", responseFormat: "object", image: 1, think: 0, tool: 1 }, { manufacturer: "other", model: "", responseFormat: "object", image: 1, think: 0, tool: 1 },
{ manufacturer: "modelScope", model: "deepseek-ai/DeepSeek-V3.2", responseFormat: "object", image: 0, think: 0, tool: 1 }, { manufacturer: "modelScope", model: "deepseek-ai/DeepSeek-V3.2", responseFormat: "object", image: 0, think: 0, tool: 1 },
{ manufacturer: "formal", model: "gpt-4.1", responseFormat: "schema", image: 1, think: 0, tool: 1 },
{ manufacturer: "formal", model: "doubao-seed-2-0-pro-260215", responseFormat: "object", image: 0, think: 0, tool: 1 },
{ manufacturer: "formal", model: "doubao-seed-1-8-251215", responseFormat: "schema", image: 0, think: 0, tool: 1 },
{ manufacturer: "formal", model: "gpt-5.2", responseFormat: "schema", image: 1, think: 0, tool: 1 },
{ manufacturer: "formal", model: "gpt-5.1", responseFormat: "schema", image: 1, think: 0, tool: 1 },
{ manufacturer: "formal", model: "claude-sonnet-4-6", responseFormat: "schema", image: 0, think: 0, tool: 1 },
{ manufacturer: "formal", model: "claude-sonnet-4-5-20250929", responseFormat: "schema", image: 0, think: 0, tool: 1 },
{ manufacturer: "formal", model: "claude-opus-4-5-20251101", responseFormat: "schema", image: 0, think: 0, tool: 1 },
{ manufacturer: "formal", model: "qwen3.5-plus", responseFormat: "schema", image: 1, think: 0, tool: 1 },
{ manufacturer: "formal", model: "qwen3-max-2026-01-23", responseFormat: "schema", image: 1, think: 0, tool: 1 },
]); ]);
}, },
}, },
@ -656,7 +640,6 @@ export default async (knex: Knex, forceInit: boolean = false): Promise<void> =>
await knex("t_imageModel").insert([ await knex("t_imageModel").insert([
{ manufacturer: "volcengine", model: "doubao-seedream-5-0-260128", grid: 1, type: "ti2i" }, { manufacturer: "volcengine", model: "doubao-seedream-5-0-260128", grid: 1, type: "ti2i" },
{ manufacturer: "volcengine", model: "doubao-seedream-4-5-251128", grid: 0, type: "ti2i" }, { manufacturer: "volcengine", model: "doubao-seedream-4-5-251128", grid: 0, type: "ti2i" },
// { manufacturer: "volcengine", model: "doubao-seedream-4-0-250828", grid: 0, type: "ti2i" },
{ manufacturer: "kling", model: "kling-image-o1", grid: 0, type: "ti2i" }, { manufacturer: "kling", model: "kling-image-o1", grid: 0, type: "ti2i" },
{ manufacturer: "gemini", model: "gemini-2.5-flash-image", grid: 1, type: "ti2i" }, { manufacturer: "gemini", model: "gemini-2.5-flash-image", grid: 1, type: "ti2i" },
{ manufacturer: "gemini", model: "gemini-3-pro-image-preview", grid: 1, type: "ti2i" }, { manufacturer: "gemini", model: "gemini-3-pro-image-preview", grid: 1, type: "ti2i" },
@ -668,7 +651,10 @@ export default async (knex: Knex, forceInit: boolean = false): Promise<void> =>
{ manufacturer: "grsai", model: "nano-banana-pro", grid: 1, type: "ti2i" }, { manufacturer: "grsai", model: "nano-banana-pro", grid: 1, type: "ti2i" },
{ manufacturer: "grsai", model: "nano-banana", grid: 1, type: "ti2i" }, { manufacturer: "grsai", model: "nano-banana", grid: 1, type: "ti2i" },
{ manufacturer: "grsai", model: "nano-banana-2", grid: 1, type: "ti2i" }, { manufacturer: "grsai", model: "nano-banana-2", grid: 1, type: "ti2i" },
{ manufacturer: "formal", model: "Qwen-Image", grid: 1, type: "ti2i" },
{ manufacturer: "formal", model: "Doubao-Seedream-5.0-Lite", grid: 1, type: "ti2i" },
{ manufacturer: "formal", model: "doubao-seedream-4-5-251128", grid: 1, type: "ti2i" },
{ manufacturer: "formal", model: "doubao-seedream-4-0-250828", grid: 1, type: "ti2i" },
]); ]);
}, },
}, },
@ -718,6 +704,14 @@ export default async (knex: Knex, forceInit: boolean = false): Promise<void> =>
audio: 0, audio: 0,
type: JSON.stringify(["endFrameOptional", "reference"]), type: JSON.stringify(["endFrameOptional", "reference"]),
}, },
{
manufacturer: "volcengine",
model: "doubao-seedance-2-0-260128",
durationResolutionMap: JSON.stringify([{ duration: [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], resolution: ["720p", "480p"] }]),
aspectRatio: JSON.stringify(["16:9", "4:3", "1:1", "3:4", "9:16", "21:9"]),
audio: 1,
type: JSON.stringify(["endFrameOptional", "multiImage"]),
},
{ {
manufacturer: "volcengine", manufacturer: "volcengine",
model: "doubao-seedance-1-0-lite-t2v-250428", model: "doubao-seedance-1-0-lite-t2v-250428",
@ -800,22 +794,6 @@ export default async (knex: Knex, forceInit: boolean = false): Promise<void> =>
audio: 0, audio: 0,
type: JSON.stringify(["singleImage", "reference", "startEndRequired", "text"]), type: JSON.stringify(["singleImage", "reference", "startEndRequired", "text"]),
}, },
{
manufacturer: "vidu",
model: "viduq1",
durationResolutionMap: JSON.stringify([{ duration: [5], resolution: ["1080p"] }]),
aspectRatio: JSON.stringify([]),
audio: 0,
type: JSON.stringify(["singleImage", "reference", "startEndRequired", "text"]),
},
{
manufacturer: "vidu",
model: "viduq1-classic",
durationResolutionMap: JSON.stringify([{ duration: [5], resolution: ["1080p"] }]),
aspectRatio: JSON.stringify([]),
audio: 0,
type: JSON.stringify(["singleImage", "startEndRequired"]),
},
{ {
manufacturer: "vidu", manufacturer: "vidu",
model: "vidu2.0", model: "vidu2.0",
@ -907,22 +885,6 @@ export default async (knex: Knex, forceInit: boolean = false): Promise<void> =>
audio: 0, audio: 0,
type: JSON.stringify(["singleImage"]), type: JSON.stringify(["singleImage"]),
}, },
{
manufacturer: "wan",
model: "wanx2.1-i2v-plus",
durationResolutionMap: JSON.stringify([{ duration: [5], resolution: ["720p"] }]),
aspectRatio: JSON.stringify([]),
audio: 0,
type: JSON.stringify(["singleImage"]),
},
{
manufacturer: "wan",
model: "wanx2.1-i2v-turbo",
durationResolutionMap: JSON.stringify([{ duration: [3, 4, 5], resolution: ["480p", "720p"] }]),
aspectRatio: JSON.stringify([]),
audio: 0,
type: JSON.stringify(["singleImage"]),
},
{ {
manufacturer: "wan", manufacturer: "wan",
model: "wan2.2-kf2v-flash", model: "wan2.2-kf2v-flash",
@ -931,14 +893,6 @@ export default async (knex: Knex, forceInit: boolean = false): Promise<void> =>
audio: 0, audio: 0,
type: JSON.stringify(["startEndRequired"]), type: JSON.stringify(["startEndRequired"]),
}, },
{
manufacturer: "wan",
model: "wanx2.1-kf2v-plus",
durationResolutionMap: JSON.stringify([{ duration: [5], resolution: ["720p"] }]),
aspectRatio: JSON.stringify([]),
audio: 0,
type: JSON.stringify(["startEndRequired"]),
},
{ {
manufacturer: "gemini", manufacturer: "gemini",
model: "veo-3.1-generate-preview", model: "veo-3.1-generate-preview",
@ -1067,46 +1021,28 @@ export default async (knex: Knex, forceInit: boolean = false): Promise<void> =>
{ {
manufacturer: "formal", manufacturer: "formal",
model: "Seedance-1.5-Pro", model: "Seedance-1.5-Pro-audio",
durationResolutionMap: JSON.stringify([{ duration: [4, 5, 6, 7, 8, 9, 10, 11, 12], resolution: ["480p", "720p", "1080p"] }]), durationResolutionMap: JSON.stringify([{ duration: [4, 5, 6, 7, 8, 9, 10, 11, 12], resolution: ["480p", "720p", "1080p"] }]),
aspectRatio: JSON.stringify(["16:9", "9:16"]), aspectRatio: JSON.stringify(["16:9", "9:16"]),
audio: 1, audio: 0,
type: JSON.stringify(["endFrameOptional", "text"]), type: JSON.stringify(["endFrameOptional"]),
},
{
manufacturer: "formal",
model: "Seedance-1.5-Pro-NotAudio",
durationResolutionMap: JSON.stringify([{ duration: [4, 5, 6, 7, 8, 9, 10, 11, 12], resolution: ["480p", "720p", "1080p"] }]),
aspectRatio: JSON.stringify(["16:9", "9:16"]),
audio: 0,
type: JSON.stringify(["endFrameOptional"]),
}, },
{ {
manufacturer: "formal", manufacturer: "formal",
model: "Seedance-1.0-Pro", model: "Seedance-1.0-Pro",
durationResolutionMap: JSON.stringify([{ duration: [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], resolution: ["480p", "720p", "1080p"] }]), durationResolutionMap: JSON.stringify([{ duration: [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], resolution: ["480p", "720p", "1080p"] }]),
aspectRatio: JSON.stringify(["16:9", "9:16"]), aspectRatio: JSON.stringify(["16:9", "9:16"]),
audio: 0, audio: 0,
type: JSON.stringify(["text", "endFrameOptional"]), type: JSON.stringify(["endFrameOptional"]),
}, },
{
manufacturer: "formal",
model: "Seedance-1.0-Pro-Fast",
durationResolutionMap: JSON.stringify([{ duration: [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], resolution: ["480p", "720p", "1080p"] }]),
aspectRatio: JSON.stringify(["16:9", "9:16"]),
audio: 0,
type: JSON.stringify(["text", "singleImage"]),
},
{
manufacturer: "formal",
model: "Seedance-1.0-Lite-I2V",
durationResolutionMap: JSON.stringify([{ duration: [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], resolution: ["480p", "720p", "1080p"] }]),
aspectRatio: JSON.stringify([]),
audio: 0,
type: JSON.stringify(["endFrameOptional", "reference"]),
},
{
manufacturer: "formal",
model: "Seedance-1.0-Lite-T2V",
durationResolutionMap: JSON.stringify([{ duration: [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], resolution: ["480p", "720p", "1080p"] }]),
aspectRatio: JSON.stringify(["16:9", "9:16"]),
audio: 0,
type: JSON.stringify(["text"]),
},
{ {
manufacturer: "formal", manufacturer: "formal",
model: "ViduQ3-turbo", model: "ViduQ3-turbo",
@ -1115,7 +1051,7 @@ export default async (knex: Knex, forceInit: boolean = false): Promise<void> =>
]), ]),
aspectRatio: JSON.stringify(["16:9", "9:16", "3:4", "4:3", "1:1"]), aspectRatio: JSON.stringify(["16:9", "9:16", "3:4", "4:3", "1:1"]),
audio: 1, audio: 1,
type: JSON.stringify(["text", "singleImage"]), type: JSON.stringify(["singleImage"]),
}, },
{ {
manufacturer: "formal", manufacturer: "formal",
@ -1125,7 +1061,7 @@ export default async (knex: Knex, forceInit: boolean = false): Promise<void> =>
]), ]),
aspectRatio: JSON.stringify(["16:9", "9:16", "3:4", "4:3", "1:1"]), aspectRatio: JSON.stringify(["16:9", "9:16", "3:4", "4:3", "1:1"]),
audio: 1, audio: 1,
type: JSON.stringify(["text", "singleImage"]), type: JSON.stringify(["singleImage"]),
}, },
{ {
manufacturer: "formal", manufacturer: "formal",
@ -1141,7 +1077,7 @@ export default async (knex: Knex, forceInit: boolean = false): Promise<void> =>
durationResolutionMap: JSON.stringify([{ duration: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], resolution: ["540p", "720p", "1080p"] }]), durationResolutionMap: JSON.stringify([{ duration: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], resolution: ["540p", "720p", "1080p"] }]),
aspectRatio: JSON.stringify([]), aspectRatio: JSON.stringify([]),
audio: 0, audio: 0,
type: JSON.stringify(["singleImage", "reference", "startEndRequired", "text"]), type: JSON.stringify(["singleImage", "reference", "startEndRequired"]),
}, },
{ {
manufacturer: "formal", manufacturer: "formal",
@ -1149,7 +1085,7 @@ export default async (knex: Knex, forceInit: boolean = false): Promise<void> =>
durationResolutionMap: JSON.stringify([{ duration: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], resolution: ["540p", "720p", "1080p"] }]), durationResolutionMap: JSON.stringify([{ duration: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], resolution: ["540p", "720p", "1080p"] }]),
aspectRatio: JSON.stringify([]), aspectRatio: JSON.stringify([]),
audio: 0, audio: 0,
type: JSON.stringify(["singleImage", "reference", "startEndRequired", "text"]), type: JSON.stringify(["singleImage", "reference", "startEndRequired"]),
}, },
{ {
manufacturer: "formal", manufacturer: "formal",
@ -1157,59 +1093,32 @@ export default async (knex: Knex, forceInit: boolean = false): Promise<void> =>
durationResolutionMap: JSON.stringify([{ duration: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], resolution: ["540p", "720p", "1080p"] }]), durationResolutionMap: JSON.stringify([{ duration: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], resolution: ["540p", "720p", "1080p"] }]),
aspectRatio: JSON.stringify([]), aspectRatio: JSON.stringify([]),
audio: 0, audio: 0,
type: JSON.stringify(["singleImage", "reference", "startEndRequired", "text"]), type: JSON.stringify(["singleImage", "reference"]),
},
{
manufacturer: "formal",
model: "ViduQ1",
durationResolutionMap: JSON.stringify([{ duration: [5], resolution: ["1080p"] }]),
aspectRatio: JSON.stringify([]),
audio: 0,
type: JSON.stringify(["singleImage", "reference", "startEndRequired", "text"]),
},
{
manufacturer: "formal",
model: "ViduQ1-classic",
durationResolutionMap: JSON.stringify([{ duration: [5], resolution: ["1080p"] }]),
aspectRatio: JSON.stringify([]),
audio: 0,
type: JSON.stringify(["singleImage", "startEndRequired"]),
},
{
manufacturer: "formal",
model: "Vidu2.0",
durationResolutionMap: JSON.stringify([
{ duration: [4], resolution: ["360p", "720p", "1080p"] },
{ duration: [8], resolution: ["720p"] },
]),
aspectRatio: JSON.stringify([]),
audio: 0,
type: JSON.stringify(["singleImage", "reference", "startEndRequired"]),
}, },
{ {
manufacturer: "formal", manufacturer: "formal",
model: "Hailuo-2.3-I2V", model: "Sora-2-I2V",
durationResolutionMap: JSON.stringify([{ duration: [6, 7, 8, 9, 10], resolution: ["1080p"] }]), durationResolutionMap: JSON.stringify([{ duration: [4, 8, 12], resolution: [] }]),
aspectRatio: JSON.stringify(["16:9", "9:16"]), aspectRatio: JSON.stringify([]),
audio: 0, audio: 0,
type: JSON.stringify(["endFrameOptional"]), type: JSON.stringify(["singleImage", "reference"]),
}, },
{ {
manufacturer: "formal", manufacturer: "formal",
model: "Hailuo-2.3-Fast", model: "Wan2.6-I2V-720P",
durationResolutionMap: JSON.stringify([{ duration: [6, 7, 8, 9, 10], resolution: ["1080p"] }]), durationResolutionMap: JSON.stringify([{ duration: [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], resolution: ["720p"] }]),
aspectRatio: JSON.stringify(["16:9", "9:16"]), aspectRatio: JSON.stringify([]),
audio: 0, audio: 1,
type: JSON.stringify(["endFrameOptional"]), type: JSON.stringify(["singleImage"]),
}, },
{ {
manufacturer: "formal", manufacturer: "formal",
model: "Hailuo-2.3-T2V", model: "Wan2.6-I2V-720P-1080P",
durationResolutionMap: JSON.stringify([{ duration: [6, 7, 8, 9, 10], resolution: ["1080p"] }]), durationResolutionMap: JSON.stringify([{ duration: [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], resolution: ["1080p"] }]),
aspectRatio: JSON.stringify(["16:9", "9:16"]), aspectRatio: JSON.stringify([]),
audio: 0, audio: 1,
type: JSON.stringify(["text"]), type: JSON.stringify(["singleImage"]),
}, },
]); ]);
}, },

View File

@ -1,6 +1,192 @@
// @db-hash a7e02eb0ccc2f0608c1cafc9191f3291 // @db-hash f991a54893850ab9ff4a67665391191d
//该文件由脚本自动生成,请勿手动修改 //该文件由脚本自动生成,请勿手动修改
export interface memories {
'access_count'?: number;
'content': string;
'created_at': number;
'embedding': string;
'id'?: string;
'type': string;
}
export interface o_agentDeploy {
'id'?: number;
'name'?: string | null;
'startTime'?: number | null;
}
export interface o_artStyle {
'id'?: number;
'name'?: string | null;
'styles'?: string | null;
}
export interface o_assets {
'id'?: number;
'name'?: string | null;
'startTime'?: number | null;
}
export interface o_chatHistory {
'data'?: string | null;
'id'?: number;
'novel'?: string | null;
'projectId'?: number | null;
'type'?: string | null;
}
export interface o_event {
'createTime'?: number | null;
'detail'?: string | null;
'id'?: number;
'name'?: string | null;
}
export interface o_eventChapter {
'createTime'?: number | null;
'id'?: number;
'name'?: string | null;
}
export interface o_image {
'assetsId'?: number | null;
'filePath'?: string | null;
'id'?: number;
'projectId'?: number | null;
'scriptId'?: number | null;
'state'?: string | null;
'type'?: string | null;
'videoId'?: number | null;
}
export interface o_model {
'id'?: number;
'name'?: string | null;
'startTime'?: number | null;
}
export interface o_myTasks {
'describe'?: string | null;
'id'?: number;
'model'?: string | null;
'projectId'?: number | null;
'reason'?: string | null;
'relatedObjects'?: string | null;
'startTime'?: number | null;
'state'?: string | null;
'taskClass'?: string | null;
}
export interface o_novel {
'chapter'?: string | null;
'chapterData'?: string | null;
'chapterIndex'?: number | null;
'createTime'?: number | null;
'id'?: number;
'projectId'?: number | null;
'reel'?: string | null;
}
export interface o_outline {
'createTime'?: number | null;
'id'?: number;
'name'?: string | null;
}
export interface o_outlineNovel {
'createTime'?: number | null;
'id'?: number;
'name'?: string | null;
}
export interface o_project {
'artStyle'?: string | null;
'createTime'?: number | null;
'id'?: number | null;
'intro'?: string | null;
'name'?: string | null;
'projectType'?: string | null;
'type'?: string | null;
'userId'?: number | null;
'videoRatio'?: string | null;
}
export interface o_prompts {
'code'?: string | null;
'customValue'?: string | null;
'defaultValue'?: string | null;
'id'?: number;
'name'?: string | null;
'parentCode'?: string | null;
'type'?: string | null;
}
export interface o_script {
'content'?: string | null;
'createTime'?: number | null;
'id'?: number;
'name'?: string | null;
'projectId'?: number | null;
}
export interface o_scriptAssets {
'createTime'?: number | null;
'id'?: number;
'name'?: string | null;
}
export interface o_scriptOutline {
'createTime'?: number | null;
'id'?: number;
'name'?: string | null;
}
export interface o_setting {
'id'?: number;
'imageModel'?: string | null;
'languageModel'?: string | null;
'projectId'?: number | null;
'tokenKey'?: string | null;
'userId'?: number | null;
}
export interface o_skills {
'id'?: number;
'name'?: string | null;
'startTime'?: number | null;
}
export interface o_storyboard {
'createTime'?: number | null;
'id'?: number;
'name'?: string | null;
}
export interface o_storyboardScript {
'createTime'?: number | null;
'id'?: number;
'name'?: string | null;
}
export interface o_user {
'id'?: number;
'name'?: string | null;
'password'?: string | null;
'tokenKey'?: string | null;
}
export interface o_vendorConfig {
'code'?: string | null;
'createTime'?: number | null;
'icon'?: string | null;
'id'?: number;
'inputs'?: string | null;
'inputValues'?: string | null;
'models'?: string | null;
'name'?: string | null;
'version'?: string | null;
}
export interface o_video {
'createTime'?: number | null;
'id'?: number;
'name'?: string | null;
}
export interface o_videoConfig {
'aiConfigId'?: number | null;
'audioEnabled'?: number | null;
'createTime'?: number | null;
'duration'?: number | null;
'endFrame'?: string | null;
'id'?: number;
'images'?: string | null;
'manufacturer'?: string | null;
'mode'?: string | null;
'projectId'?: number | null;
'prompt'?: string | null;
'resolution'?: string | null;
'scriptId'?: number | null;
'selectedResultId'?: number | null;
'startFrame'?: string | null;
'updateTime'?: number | null;
}
export interface t_aiModelMap { export interface t_aiModelMap {
'configId'?: number | null; 'configId'?: number | null;
'id'?: number; 'id'?: number;
@ -178,6 +364,32 @@ export interface t_videoModel {
} }
export interface DB { export interface DB {
"memories": memories;
"o_agentDeploy": o_agentDeploy;
"o_artStyle": o_artStyle;
"o_assets": o_assets;
"o_chatHistory": o_chatHistory;
"o_event": o_event;
"o_eventChapter": o_eventChapter;
"o_image": o_image;
"o_model": o_model;
"o_myTasks": o_myTasks;
"o_novel": o_novel;
"o_outline": o_outline;
"o_outlineNovel": o_outlineNovel;
"o_project": o_project;
"o_prompts": o_prompts;
"o_script": o_script;
"o_scriptAssets": o_scriptAssets;
"o_scriptOutline": o_scriptOutline;
"o_setting": o_setting;
"o_skills": o_skills;
"o_storyboard": o_storyboard;
"o_storyboardScript": o_storyboardScript;
"o_user": o_user;
"o_vendorConfig": o_vendorConfig;
"o_video": o_video;
"o_videoConfig": o_videoConfig;
"t_aiModelMap": t_aiModelMap; "t_aiModelMap": t_aiModelMap;
"t_artStyle": t_artStyle; "t_artStyle": t_artStyle;
"t_assets": t_assets; "t_assets": t_assets;

View File

@ -17,7 +17,7 @@ export default async (input: ImageConfig, config: AIConfig): Promise<string> =>
if (!config.model) throw new Error("缺少Model名称"); if (!config.model) throw new Error("缺少Model名称");
if (!config.apiKey) throw new Error("缺少API Key"); if (!config.apiKey) throw new Error("缺少API Key");
const { requestUrl, queryUrl = null } = modelFn["volcengine"].buildReqUrl("http://192.168.0.74:33332"); const { requestUrl, queryUrl = null } = modelFn["volcengine"].buildReqUrl(config.baseURL || "https://api.toonflow.net");
const taskBody = modelFn["volcengine"].buildReqBody(input, config); const taskBody = modelFn["volcengine"].buildReqBody(input, config);
const apiKey = config.apiKey.replace("Bearer ", ""); const apiKey = config.apiKey.replace("Bearer ", "");

View File

@ -6,12 +6,15 @@ export function buildReqBody(input: VideoConfig, config: AIConfig) {
...(input.imageBase64 && input.imageBase64.length ? { images: input.imageBase64 } : {}), ...(input.imageBase64 && input.imageBase64.length ? { images: input.imageBase64 } : {}),
prompt: input.prompt, prompt: input.prompt,
duration: input.duration, duration: input.duration,
resolution: input.resolution, size: input.resolution,
audio: input?.audio ?? false, metadata: {
aspect_ratio: input.aspectRatio, aspect_ratio: input.aspectRatio,
audio: input?.audio ?? false,
off_peak: false, off_peak: false,
},
}; };
console.log("%c Line:5 🍔 requestBody", "background:#465975", requestBody);
return requestBody; return requestBody;
} }

View File

@ -34,6 +34,7 @@ export function buildReqBody(input: VideoConfig, config: AIConfig) {
size: input.resolution, size: input.resolution,
metadata: { metadata: {
generate_audio: input?.audio ?? false, generate_audio: input?.audio ?? false,
ratio: input.aspectRatio,
image_roles: ["first_frame", "last_frame"], image_roles: ["first_frame", "last_frame"],
}, },
}; };

View File

@ -26,26 +26,25 @@ export function buildReqBody(input: VideoConfig, config: AIConfig) {
}, },
}; };
const hasStartEnd = input.mode == "startEnd"; const hasStartEnd = input.mode == "startEnd";
console.log("%c Line:29 🎂 hasStartEnd", "background:#2eafb0", hasStartEnd);
const imageReq: Record<string, string> = {}; const imageReq: Record<string, string> = {};
if (hasStartEnd && Array.isArray(images) && images.length) { if (hasStartEnd && Array.isArray(images) && images.length) {
if (images[0]) imageReq.img_url = images[0]; if (images[0]) imageReq.first_frame_url = images[0];
if (images[1]) imageReq.last_frame_url = images[1]; if (images[1]) imageReq.last_frame_url = images[1];
} else if (!hasStartEnd && Array.isArray(images) && images[0]) { } else if (!hasStartEnd && Array.isArray(images) && images[0]) {
console.log("%c Line:35 🍤", "background:#f5ce50");
imageReq.img_url = images[0]; imageReq.img_url = images[0];
} }
const resolutionKey = input.resolution.toLowerCase(); const resolutionKey = input.resolution;
console.log("%c Line:43 🍑 resolutionKey", "background:#e41a6a", resolutionKey);
const size = sizeMap[resolutionKey]?.[input.aspectRatio]; const size = sizeMap[resolutionKey]?.[input.aspectRatio];
const requestBody: any = { const requestBody: any = {
model: config.model, model: config.model,
...(imageReq?.img_url ? { input_reference: imageReq.img_url } : {}), ...(imageReq?.img_url ? { input_reference: imageReq.img_url } : {}),
prompt: input.prompt, prompt: input.prompt,
size,
duration: input.duration, duration: input.duration,
size: !images.length ? size : input.resolution.toUpperCase(),
metadata: { metadata: {
...imageReq, ...imageReq,
audio: input?.audio ?? false, audio: input?.audio ?? false,

View File

@ -82,7 +82,7 @@ export default async (input: VideoConfig, config: AIConfig): Promise<string> =>
// 根据模型名称获取对应的适配器 // 根据模型名称获取对应的适配器
const modelAdapter = getModelAdapter(config.model); const modelAdapter = getModelAdapter(config.model);
const { requestUrl, queryUrl, downLoadUrl = null } = modelAdapter.buildReqUrl("http://192.168.0.74:33332"); const { requestUrl, queryUrl, downLoadUrl = null } = modelAdapter.buildReqUrl(config.baseURL || "https://api.toonflow.net");
const taskBody = await modelAdapter.buildReqBody(input, config); const taskBody = await modelAdapter.buildReqBody(input, config);
const apiKey = config.apiKey.replace("Bearer ", ""); const apiKey = config.apiKey.replace("Bearer ", "");

View File

@ -71,29 +71,15 @@ export default async (input: VideoConfig, config: AIConfig) => {
const requestBody: any = { const requestBody: any = {
model: config.model, model: config.model,
images: [ prompt: input.prompt,
"https://prod-ss-images.s3.cn-northwest-1.amazonaws.com.cn/vidu-maas/template/startend2video-1.jpeg", aspect_ratio: input.aspectRatio || "16:9",
"https://prod-ss-images.s3.cn-northwest-1.amazonaws.com.cn/vidu-maas/template/startend2video-2.jpeg", size: "720p",
],
prompt:
"The camera zooms in on the bird, which then flies to the right. With its flight being smooth and natural, the bird soars in the sky. with a red light effect following and surrounding it from behind.",
duration: 5,
seed: 0,
resolution: "1080p",
audio: true,
off_peak: false,
}; };
if (input.imageBase64 && input.imageBase64.length) { if (input.imageBase64 && input.imageBase64.length) {
requestBody.images = [ requestBody.images = input.imageBase64;
"https://prod-ss-images.s3.cn-northwest-1.amazonaws.com.cn/vidu-maas/template/startend2video-1.jpeg",
"https://prod-ss-images.s3.cn-northwest-1.amazonaws.com.cn/vidu-maas/template/startend2video-2.jpeg",
];
} }
console.log("%c Line:86 🍷 requestUrl", "background:#4fff4B", requestUrl);
console.log("%c Line:89 🥪 authorization", "background:#3f7cff", authorization);
const response = await axios.post(requestUrl, JSON.stringify(requestBody), { const response = await axios.post(requestUrl, JSON.stringify(requestBody), {
headers: { headers: {
Authorization: authorization, Authorization: authorization,
@ -102,7 +88,6 @@ export default async (input: VideoConfig, config: AIConfig) => {
}); });
taskId = response.data.id; taskId = response.data.id;
resData = response.data; resData = response.data;
console.log("%c Line:91 🍎 resData", "background:#ed9ec7", resData);
} }
console.log("%c Line:87 🥒 taskId", "background:#f5ce50", taskId); console.log("%c Line:87 🥒 taskId", "background:#f5ce50", taskId);
@ -110,7 +95,7 @@ export default async (input: VideoConfig, config: AIConfig) => {
return await pollTask(async () => { return await pollTask(async () => {
// 构建查询URL两个地址模式时使用URL参数 // 构建查询URL两个地址模式时使用URL参数
const finalQueryUrl = isThreeUrlMode ? template({ id: taskId }, queryUrl) : template({ id: taskId }, queryUrl); const finalQueryUrl = isThreeUrlMode ? template({ id: taskId }, queryUrl) : `${queryUrl}?id=${taskId}`;
const { data: queryData } = await axios.get(finalQueryUrl, { const { data: queryData } = await axios.get(finalQueryUrl, {
headers: { Authorization: authorization }, headers: { Authorization: authorization },
@ -126,8 +111,7 @@ export default async (input: VideoConfig, config: AIConfig) => {
for (let i = 0; i < retries; i++) { for (let i = 0; i < retries; i++) {
try { try {
// 构建下载URL // 构建下载URL
const finalDownloadUrl = const finalDownloadUrl = isThreeUrlMode && downLoadUrl ? template({ id: taskId }, downLoadUrl) : queryData.video_url || queryData.url; // 从响应中获取视频URL
isThreeUrlMode && downLoadUrl ? template({ id: taskId }, downLoadUrl) : queryData.video_url || queryData.url || queryData.metadata.url; // 从响应中获取视频URL
videoRes = await axios.get(finalDownloadUrl, { videoRes = await axios.get(finalDownloadUrl, {
headers: isThreeUrlMode ? { Authorization: authorization } : {}, headers: isThreeUrlMode ? { Authorization: authorization } : {},

View File

@ -71,15 +71,29 @@ export default async (input: VideoConfig, config: AIConfig) => {
const requestBody: any = { const requestBody: any = {
model: config.model, model: config.model,
prompt: input.prompt, images: [
aspect_ratio: input.aspectRatio || "16:9", "https://prod-ss-images.s3.cn-northwest-1.amazonaws.com.cn/vidu-maas/template/startend2video-1.jpeg",
size: "720p", "https://prod-ss-images.s3.cn-northwest-1.amazonaws.com.cn/vidu-maas/template/startend2video-2.jpeg",
],
prompt:
"The camera zooms in on the bird, which then flies to the right. With its flight being smooth and natural, the bird soars in the sky. with a red light effect following and surrounding it from behind.",
duration: 5,
seed: 0,
resolution: "1080p",
audio: true,
off_peak: false,
}; };
if (input.imageBase64 && input.imageBase64.length) { if (input.imageBase64 && input.imageBase64.length) {
requestBody.images = input.imageBase64; requestBody.images = [
"https://prod-ss-images.s3.cn-northwest-1.amazonaws.com.cn/vidu-maas/template/startend2video-1.jpeg",
"https://prod-ss-images.s3.cn-northwest-1.amazonaws.com.cn/vidu-maas/template/startend2video-2.jpeg",
];
} }
console.log("%c Line:86 🍷 requestUrl", "background:#4fff4B", requestUrl);
console.log("%c Line:89 🥪 authorization", "background:#3f7cff", authorization);
const response = await axios.post(requestUrl, JSON.stringify(requestBody), { const response = await axios.post(requestUrl, JSON.stringify(requestBody), {
headers: { headers: {
Authorization: authorization, Authorization: authorization,
@ -88,6 +102,7 @@ export default async (input: VideoConfig, config: AIConfig) => {
}); });
taskId = response.data.id; taskId = response.data.id;
resData = response.data; resData = response.data;
console.log("%c Line:91 🍎 resData", "background:#ed9ec7", resData);
} }
console.log("%c Line:87 🥒 taskId", "background:#f5ce50", taskId); console.log("%c Line:87 🥒 taskId", "background:#f5ce50", taskId);
@ -95,7 +110,7 @@ export default async (input: VideoConfig, config: AIConfig) => {
return await pollTask(async () => { return await pollTask(async () => {
// 构建查询URL两个地址模式时使用URL参数 // 构建查询URL两个地址模式时使用URL参数
const finalQueryUrl = isThreeUrlMode ? template({ id: taskId }, queryUrl) : `${queryUrl}?id=${taskId}`; const finalQueryUrl = isThreeUrlMode ? template({ id: taskId }, queryUrl) : template({ id: taskId }, queryUrl);
const { data: queryData } = await axios.get(finalQueryUrl, { const { data: queryData } = await axios.get(finalQueryUrl, {
headers: { Authorization: authorization }, headers: { Authorization: authorization },
@ -111,7 +126,8 @@ export default async (input: VideoConfig, config: AIConfig) => {
for (let i = 0; i < retries; i++) { for (let i = 0; i < retries; i++) {
try { try {
// 构建下载URL // 构建下载URL
const finalDownloadUrl = isThreeUrlMode && downLoadUrl ? template({ id: taskId }, downLoadUrl) : queryData.video_url || queryData.url; // 从响应中获取视频URL const finalDownloadUrl =
isThreeUrlMode && downLoadUrl ? template({ id: taskId }, downLoadUrl) : queryData.video_url || queryData.url || queryData.metadata.url; // 从响应中获取视频URL
videoRes = await axios.get(finalDownloadUrl, { videoRes = await axios.get(finalDownloadUrl, {
headers: isThreeUrlMode ? { Authorization: authorization } : {}, headers: isThreeUrlMode ? { Authorization: authorization } : {},

View File

@ -1 +0,0 @@
resizedBuffer

View File

@ -21,6 +21,8 @@ export default async (input: VideoConfig, config: AIConfig) => {
}; };
if (isStartEndMode) { if (isStartEndMode) {
item.role = index === 0 ? "first_frame" : "last_frame"; item.role = index === 0 ? "first_frame" : "last_frame";
} else {
item.role = "reference_image";
} }
return item; return item;
}); });
@ -35,7 +37,7 @@ export default async (input: VideoConfig, config: AIConfig) => {
}; };
// 仅当模型支持音频时才添加 generate_audio 字段 // 仅当模型支持音频时才添加 generate_audio 字段
if (input?.audio) { if (typeof input?.audio == "boolean") {
requestBody.generate_audio = input.audio ?? false; requestBody.generate_audio = input.audio ?? false;
} }
@ -46,7 +48,7 @@ export default async (input: VideoConfig, config: AIConfig) => {
Authorization: authorization, Authorization: authorization,
}, },
}); });
console.log("%c Line:44 🍡 createResponse", "background:#2eafb0", createResponse); console.log("%c Line:44 🍡 createResponse", "background:#2eafb0", createResponse.data);
const taskId = createResponse.data.id; const taskId = createResponse.data.id;
@ -54,7 +56,7 @@ export default async (input: VideoConfig, config: AIConfig) => {
// 轮询任务状态 // 轮询任务状态
return await pollTask(async () => { return await pollTask(async () => {
const data = await axios.get(`${baseUrl}/query/${taskId}`, { const data = await axios.get(`${baseUrl}/${taskId}`, {
headers: { Authorization: authorization }, headers: { Authorization: authorization },
}); });
console.log("%c Line:62 🥕 data.data", "background:#e41a6a", data.data); console.log("%c Line:62 🥕 data.data", "background:#e41a6a", data.data);