更新带货视频工作流接口和页面

This commit is contained in:
super
2026-07-09 00:27:49 +08:00
parent 0ecf5cd45a
commit aab4ce942c
51 changed files with 4777 additions and 820 deletions

View File

@@ -100,13 +100,35 @@ export interface UploadFileVo {
localPath: string;
size: number;
relativePath?: string;
objectKey?: string;
url?: string;
mediaType?: "image" | "video" | "audio" | "file" | string;
}
export async function uploadTempFileToJava(file: File, relativePath?: string) {
export interface UploadTempFileOptions {
relativePath?: string;
uploadToOss?: boolean;
moduleType?: string;
}
export async function uploadTempFileToJava(
file: File,
relativePathOrOptions?: string | UploadTempFileOptions,
) {
const options =
typeof relativePathOrOptions === 'string'
? { relativePath: relativePathOrOptions }
: relativePathOrOptions || {}
const formData = new FormData()
formData.append('file', file)
if (relativePath) {
formData.append('relativePath', relativePath)
if (options.relativePath) {
formData.append('relativePath', options.relativePath)
}
if (options.uploadToOss) {
formData.append('uploadToOss', 'true')
}
if (options.moduleType) {
formData.append('moduleType', options.moduleType)
}
const response = await http.post<JavaApiResponse<UploadFileVo>>(
`${JAVA_API_PREFIX}/files/upload`,
@@ -2437,6 +2459,11 @@ export interface SkipPriceAsinPageVo {
totalPages: number;
skipAsinsByCountry: Record<string, string[]>;
skipAsinDetailsByCountry: Record<string, Array<{ asin?: string; minimumPrice?: string }>>;
skip_asins?: Record<string, string[]>;
skip_asins_by_country?: Record<string, string[]>;
skip_asin_details_by_country?: Record<string, Array<{ asin?: string; minimumPrice?: string }>>;
asin_rows_by_country?: Record<string, Array<{ asin?: string; minimumPrice?: string }>>;
minimum_price_by_country_and_asin?: Record<string, Record<string, string>>;
}
export function deletePendingPriceTrackShopResult(shopName: string) {
@@ -2447,6 +2474,232 @@ export function deletePendingPriceTrackShopResult(shopName: string) {
);
}
// ========== 视频复刻 / 图生视频 ==========
export interface ImageVideoDouyinCopyVo {
recognizedContent?: string;
scriptDraft?: string;
executeId?: string;
debugUrl?: string;
}
export interface ImageVideoSecretStatusVo {
userId?: number;
configured?: boolean;
valid?: boolean;
expired?: boolean;
hasCopyApiKey?: boolean;
hasT8Key?: boolean;
hasVoiceApiKey?: boolean;
hasVoiceGroupId?: boolean;
copyApiKeyMasked?: string;
t8KeyMasked?: string;
voiceApiKeyMasked?: string;
voiceGroupIdMasked?: string;
expireDays?: number;
expiresAt?: string;
}
export interface ImageVideoSecretSavePayload {
copyApiKey?: string;
t8Key?: string;
voiceApiKey?: string;
voiceGroupId?: string;
expireDays: number;
}
export interface ImageVideoWorkflowParameters {
api_key_info: {
t8star_key: string;
ai_conductor_key: string;
};
bg_info: {
type: number;
prompt: string;
bg_image: string;
};
face_info: {
type: number;
model_figure: string;
model_image: string[];
};
proc_info: {
type: string;
name: string;
proc_image: string[];
properties: string;
};
text_info: {
type: number;
language: string;
text: string;
file_url: string;
};
video_info: {
video_url: string;
share_url: string;
ref_video_mode: string;
mode: string;
model: string;
prompt: string;
ratio: string;
resolution: string;
duration: string;
};
}
export interface ImageVideoWorkflowResponse {
code?: number;
msg?: string;
data?: string;
execute_id?: string;
debug_url?: string;
[key: string]: unknown;
}
export interface ImageVideoMediaUploadVo {
url: string;
objectKey: string;
originalFilename: string;
mediaType: "image" | "video" | "audio" | string;
}
export interface ImageVideoVoiceWorkflowResponse {
code?: number;
msg?: string;
data?: unknown;
execute_id?: string;
debug_url?: string;
[key: string]: unknown;
}
export interface ImageVideoWorkflowRunRequest {
userId: number;
parameters: ImageVideoWorkflowParameters;
}
export interface ImageVideoWorkflowResultRequest {
userId: number;
executeId: string;
}
export function getImageVideoSecretStatus() {
return unwrapJavaResponse(
get<JavaApiResponse<ImageVideoSecretStatusVo>>(
`${JAVA_API_PREFIX}/image-video/secrets`,
{ params: { user_id: getCurrentUserId() } },
),
);
}
export function saveImageVideoSecrets(payload: ImageVideoSecretSavePayload) {
return unwrapJavaResponse(
put<JavaApiResponse<ImageVideoSecretStatusVo>, ImageVideoSecretSavePayload & { userId: number }>(
`${JAVA_API_PREFIX}/image-video/secrets`,
{ ...payload, userId: getCurrentUserId() },
),
);
}
export function runImageVideoDouyinCopy(url: string) {
return unwrapJavaResponse(
post<JavaApiResponse<ImageVideoDouyinCopyVo>, { userId: number; url: string }>(
`${JAVA_API_PREFIX}/image-video/douyin-copy`,
{ userId: getCurrentUserId(), url },
{ timeout: 180000 },
),
);
}
export function runImageVideoWorkflow(parameters: ImageVideoWorkflowParameters) {
return unwrapJavaResponse(
post<JavaApiResponse<ImageVideoWorkflowResponse>, ImageVideoWorkflowRunRequest>(
`${JAVA_API_PREFIX}/image-video/workflow/run`,
{ userId: getCurrentUserId(), parameters },
{ timeout: 120000 },
),
);
}
export function getImageVideoWorkflowResult(executeId: string) {
return unwrapJavaResponse(
post<JavaApiResponse<ImageVideoWorkflowResponse>, ImageVideoWorkflowResultRequest>(
`${JAVA_API_PREFIX}/image-video/workflow/result`,
{ userId: getCurrentUserId(), executeId },
{ timeout: 600000 },
),
);
}
export async function uploadImageVideoMedia(file: File) {
const response = await uploadTempFileToJava(file, {
uploadToOss: true,
moduleType: "IMAGE_VIDEO",
});
if (!response.success) {
throw new Error(response.message || "请求失败");
}
const data = response.data;
if (!data?.url || !data.objectKey) {
throw new Error("OSS 上传未返回有效 URL");
}
return {
url: data.url,
objectKey: data.objectKey,
originalFilename: data.originalFilename || file.name,
mediaType: data.mediaType || resolveImageVideoMediaType(file),
} as ImageVideoMediaUploadVo;
}
function resolveImageVideoMediaType(file: File) {
const type = (file.type || "").toLowerCase();
const name = (file.name || "").toLowerCase();
if (type.startsWith("image/") || /\.(png|jpe?g|webp|gif|bmp|svg)$/.test(name)) return "image";
if (type.startsWith("video/") || /\.(mp4|mov|webm|m4v|ogg|avi|mkv)$/.test(name)) return "video";
if (type.startsWith("audio/") || /\.(mp3|wav|m4a|aac|flac)$/.test(name)) return "audio";
return "file";
}
export function listImageVideoVoices() {
return unwrapJavaResponse(
post<JavaApiResponse<ImageVideoVoiceWorkflowResponse>, { userId: number }>(
`${JAVA_API_PREFIX}/image-video/voice/list`,
{ userId: getCurrentUserId() },
{ timeout: 180000 },
),
);
}
export function deleteImageVideoVoice(voiceId: string) {
return unwrapJavaResponse(
post<JavaApiResponse<ImageVideoVoiceWorkflowResponse>, { userId: number; voiceId: string }>(
`${JAVA_API_PREFIX}/image-video/voice/delete`,
{ userId: getCurrentUserId(), voiceId },
{ timeout: 180000 },
),
);
}
export function cloneImageVideoVoice(payload: { audioUrl?: string; videoUrl?: string }) {
return unwrapJavaResponse(
post<JavaApiResponse<ImageVideoVoiceWorkflowResponse>, { userId: number; audioUrl?: string; videoUrl?: string }>(
`${JAVA_API_PREFIX}/image-video/voice/clone`,
{ userId: getCurrentUserId(), ...payload },
{ timeout: 180000 },
),
);
}
export function synthesizeImageVideoVoice(payload: { text: string; voiceId: string }) {
return unwrapJavaResponse(
post<JavaApiResponse<ImageVideoVoiceWorkflowResponse>, { userId: number; text: string; voiceId: string }>(
`${JAVA_API_PREFIX}/image-video/voice/synthesis`,
{ userId: getCurrentUserId(), ...payload },
{ timeout: 180000 },
),
);
}
// ========== 采集数据 ==========
export interface CollectDataSourceFile {