feat: 功能优化

This commit is contained in:
2026-01-17 14:43:42 +08:00
parent 5ed0cfff07
commit fecd47e25d
60 changed files with 3529 additions and 827 deletions

View File

@@ -82,7 +82,10 @@ export async function uploadAndIdentifyVideo(file) {
hideLoading()
showLoading('正在上传视频...')
const uploadRes = await MaterialService.uploadFile(file, 'video', coverBase64)
// 使用useUpload Hook注意这里需要在组件中使用这里先用MaterialService
// TODO: 在组件中集成useUpload Hook
const uploadRes = await MaterialService.uploadFile(file, 'video', coverBase64, null, null)
hideLoading()
if (uploadRes.code !== 0) {

View File

@@ -67,9 +67,10 @@ export const MaterialService = {
* @param {string} fileCategory - 文件分类video/generate/audio/mix/voice
* @param {string} coverBase64 - 视频封面 base64可选data URI 格式)
* @param {number} duration - 视频时长(秒,可选,自动获取)
* @param {number} groupId - 分组编号(可选)
* @returns {Promise}
*/
async uploadFile(file, fileCategory, coverBase64 = null, duration = null) {
async uploadFile(file, fileCategory, coverBase64 = null, duration = null, groupId = null) {
if (duration === null && file.type.startsWith('video/')) {
duration = await getVideoDuration(file);
}
@@ -86,11 +87,37 @@ export const MaterialService = {
formData.append('coverBase64', coverBase64)
}
if (groupId !== null) {
formData.append('groupId', groupId.toString())
}
return http.post(`${BASE_URL}/upload`, formData, {
timeout: 30 * 60 * 1000
})
},
/**
* 获取预签名URL直传模式
* @param {Object} params - 请求参数
* @param {string} params.fileName - 文件名
* @param {string} params.fileCategory - 文件分类
* @param {number} params.groupId - 分组编号(可选)
* @param {number} params.fileSize - 文件大小(可选)
* @returns {Promise}
*/
getPresignedUrl(params) {
return http.get(`${BASE_URL}/presigned-url`, { params })
},
/**
* 确认上传(直传模式)
* @param {Object} data - 上传确认数据
* @returns {Promise}
*/
completeUpload(data) {
return http.post(`${BASE_URL}/complete-upload`, data)
},
/**
* 删除文件(批量)
* @param {Array<number>} fileIds - 文件编号列表
@@ -192,6 +219,15 @@ export const MaterialGroupService = {
return http.get(`${GROUP_BASE_URL}/list`)
},
/**
* 按分类查询分组列表
* @param {string} category - 分类MIX 或 DIGITAL_HUMAN
* @returns {Promise}
*/
getGroupListByCategory(category) {
return http.get(`${GROUP_BASE_URL}/list-by-category/${category}`)
},
/**
* 将文件添加到分组
* @param {Object} data - 请求数据