语言转文字接口

This commit is contained in:
yanghang
2025-06-27 17:07:08 +08:00
parent 2830d02d50
commit 58065003d3
7 changed files with 308 additions and 64 deletions
+25
View File
@@ -62,6 +62,31 @@ export function downloadFile(id) {
});
});
}
// 上传音频 翻译文本
export const uploadVoiceFile = (file) => {
const url = '/trastudy/traStdyInfo/audioTranscriptions';
const base_url = get_base_url(url);
const token = getToken();
const header = {
"Content-Type": "multipart/form-data; charset=UTF-8",
};
if (token)
header['summary'] = token
return new Promise((resolve, reject) => {
uni.uploadFile({
url: `${base_url}${url}`,
header: header,
filePath: file,
name: 'voice',
success(result) {
resolve(result)
},
fail(error) {
reject(new Error('Upload failed'));
}
});
});
};
// 获取音频 通用
export function downloadVoiceFile(url) {
const token = getToken();