multi-modal-mcp 0.0.3 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config.js +1 -1
- package/dist/tools/VideoGenerationTool.js +12 -14
- package/package.json +1 -1
package/dist/config.js
CHANGED
|
@@ -54,9 +54,9 @@ class VideoGenerationTool extends MCPTool {
|
|
|
54
54
|
.default('1024x1024')
|
|
55
55
|
.describe('视频分辨率,默认1024x1024'),
|
|
56
56
|
fps: z
|
|
57
|
-
.
|
|
57
|
+
.enum(['30', '60'])
|
|
58
58
|
.optional()
|
|
59
|
-
.default(30)
|
|
59
|
+
.default('30')
|
|
60
60
|
.describe('视频帧率(FPS),可选值为 30 或 60,默认30'),
|
|
61
61
|
});
|
|
62
62
|
/**
|
|
@@ -67,19 +67,18 @@ class VideoGenerationTool extends MCPTool {
|
|
|
67
67
|
const requestData = {
|
|
68
68
|
model: config.videoModel,
|
|
69
69
|
prompt: input.prompt,
|
|
70
|
-
quality: input.quality
|
|
71
|
-
with_audio: input.withAudio
|
|
72
|
-
watermark_enabled: input.watermarkEnabled
|
|
73
|
-
image_url: input.imageUrl,
|
|
70
|
+
quality: input.quality,
|
|
71
|
+
with_audio: input.withAudio,
|
|
72
|
+
watermark_enabled: input.watermarkEnabled,
|
|
73
|
+
// image_url: input.imageUrl,
|
|
74
74
|
size: input.size,
|
|
75
|
-
fps: input.fps
|
|
75
|
+
fps: parseInt(String(input.fps)),
|
|
76
76
|
};
|
|
77
77
|
const apiResponse = (await http.post('/videos/generations', requestData));
|
|
78
78
|
const taskId = apiResponse.id;
|
|
79
79
|
if (!taskId)
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
return videoUrl;
|
|
80
|
+
return `视频生成失败,${JSON.stringify(apiResponse)}`;
|
|
81
|
+
return await this.pollTaskStatus(taskId);
|
|
83
82
|
}
|
|
84
83
|
catch (error) {
|
|
85
84
|
return `视频生成时发生错误: ${error}`;
|
|
@@ -90,12 +89,11 @@ class VideoGenerationTool extends MCPTool {
|
|
|
90
89
|
*/
|
|
91
90
|
async pollTaskStatus(taskId) {
|
|
92
91
|
const startTime = Date.now();
|
|
93
|
-
const timeout = 60000;
|
|
92
|
+
const timeout = 60000 * 3;
|
|
94
93
|
while (true) {
|
|
95
94
|
const elapsedTime = Date.now() - startTime;
|
|
96
|
-
if (elapsedTime >= timeout)
|
|
97
|
-
|
|
98
|
-
}
|
|
95
|
+
if (elapsedTime >= timeout)
|
|
96
|
+
return `任务超时,请检查任务状态`;
|
|
99
97
|
const apiResponse = (await http.get(`/async-result/${taskId}`));
|
|
100
98
|
const taskData = apiResponse;
|
|
101
99
|
if (taskData.task_status === 'SUCCESS' &&
|