优化
This commit is contained in:
46
frontend/api/services/bailian.js
Normal file
46
frontend/api/services/bailian.js
Normal file
@@ -0,0 +1,46 @@
|
||||
import { API_BASE } from '@gold/config/api'
|
||||
|
||||
// 百炼API基础路径
|
||||
const BASE_URL = API_BASE.TIKHUB_APP || API_BASE.TIKHUB || ''
|
||||
|
||||
/**
|
||||
* 创建百炼Service实例
|
||||
* @param {Object} httpClient - HTTP客户端实例(可选)
|
||||
* @returns {Object} 百炼API对象
|
||||
*/
|
||||
export function createBaiLianService(httpClient) {
|
||||
const getClient = async () => {
|
||||
if (httpClient) {
|
||||
return httpClient
|
||||
}
|
||||
const clientModule = await import('@gold/api/axios/client')
|
||||
return clientModule.default
|
||||
}
|
||||
|
||||
return {
|
||||
/**
|
||||
* 视频转字符(音频转文字)
|
||||
* @param {Object} params - 请求参数
|
||||
* @param {string[]} params.fileLinkList - 音频文件链接列表
|
||||
* @returns {Promise<{ data: string }>} 响应数据
|
||||
*/
|
||||
async videoToCharacters(params) {
|
||||
const { fileLinkList } = params
|
||||
const client = await getClient()
|
||||
|
||||
return await client.post(`${BASE_URL}/videoToCharacters2`, {
|
||||
fileLinkList,
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 调用工作流
|
||||
* @param {Object} data - 请求数据
|
||||
* @returns {Promise<Object>} 响应数据
|
||||
*/
|
||||
async callWorkflow(data) {
|
||||
const client = await getClient()
|
||||
return await client.post(`${BASE_URL}/callWorkflow`, data)
|
||||
},
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user