@kolbo/mcp 1.113.2 → 1.113.3
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/package.json +1 -1
- package/src/tools/generate.js +14 -5
package/package.json
CHANGED
package/src/tools/generate.js
CHANGED
|
@@ -1950,6 +1950,18 @@ function registerGenerateTools(server, client, options = {}) {
|
|
|
1950
1950
|
if (!source) throw new Error('source is required (URL or absolute local path to image/video)');
|
|
1951
1951
|
if (!audio) throw new Error('audio is required (URL or absolute local path to audio file)');
|
|
1952
1952
|
|
|
1953
|
+
// Upload local files first so the card can show the face source and the
|
|
1954
|
+
// audio from the same CDN URLs the API receives (multipart left the card
|
|
1955
|
+
// with no references at all).
|
|
1956
|
+
({ source, audio } = await rehostLocalPaths(client, { source, audio, project_id }, { allowLocalFiles: !options.remote }));
|
|
1957
|
+
const isVideoUrl = (u) => /\.(mp4|mov|webm|mkv|avi|m4v)(\?|$)/i.test(u);
|
|
1958
|
+
const httpRef = (u) => (typeof u === 'string' && /^https?:\/\//i.test(u) ? [u] : []);
|
|
1959
|
+
const lipsyncRefs = {
|
|
1960
|
+
reference_images: httpRef(source).filter((u) => !isVideoUrl(u)),
|
|
1961
|
+
reference_videos: httpRef(source).filter(isVideoUrl),
|
|
1962
|
+
reference_audio: httpRef(audio),
|
|
1963
|
+
};
|
|
1964
|
+
|
|
1953
1965
|
const sourceIsUrl = typeof source === 'string' && /^https?:\/\//i.test(source);
|
|
1954
1966
|
const audioIsUrl = typeof audio === 'string' && /^https?:\/\//i.test(audio);
|
|
1955
1967
|
|
|
@@ -2005,8 +2017,7 @@ function registerGenerateTools(server, client, options = {}) {
|
|
|
2005
2017
|
|
|
2006
2018
|
if (returnsImmediately()) return submittedResult({
|
|
2007
2019
|
tool: 'generate_lipsync', kind: 'video', gen: startResponse, client, model,
|
|
2008
|
-
prompt: text_prompt, settings: { mode: 'lipsync' },
|
|
2009
|
-
reference_images: sourceIsUrl && !/\.(mp4|mov|webm|mkv|avi|m4v)(\?|$)/i.test(source) ? [source] : [],
|
|
2020
|
+
prompt: text_prompt, settings: { mode: 'lipsync' }, ...lipsyncRefs,
|
|
2010
2021
|
});
|
|
2011
2022
|
|
|
2012
2023
|
const poll = await pollOrTimedOut(client, startResponse.generation_id, {
|
|
@@ -2018,9 +2029,7 @@ function registerGenerateTools(server, client, options = {}) {
|
|
|
2018
2029
|
|
|
2019
2030
|
return uiCompleted({
|
|
2020
2031
|
tool: 'generate_lipsync', kind: 'video', gen: startResponse, client, model,
|
|
2021
|
-
prompt: text_prompt, settings: { mode: 'lipsync' },
|
|
2022
|
-
reference_images: sourceIsUrl && !/\.(mp4|mov|webm|mkv|avi|m4v)(\?|$)/i.test(source) ? [source] : [],
|
|
2023
|
-
reference_videos: sourceIsUrl && /\.(mp4|mov|webm|mkv|avi|m4v)(\?|$)/i.test(source) ? [source] : [],
|
|
2032
|
+
prompt: text_prompt, settings: { mode: 'lipsync' }, ...lipsyncRefs,
|
|
2024
2033
|
urls: result.result?.urls || [],
|
|
2025
2034
|
thumbnail_url: result.result?.thumbnail_url || null,
|
|
2026
2035
|
duration: result.result?.duration || null,
|