Files
sionrui/frontend/api/services/bailian.js

47 lines
1.2 KiB
JavaScript
Raw Normal View History

2026-01-18 15:27:43 +08:00
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)
},
}
}