|
@@ -2670,7 +2670,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
|
|
|
- // 增强 submitToAiVoiceInteraction 方法
|
|
|
+ // 修改 submitToAiVoiceInteraction 方法
|
|
|
submitToAiVoiceInteraction(videoUrl) {
|
|
|
console.log('提交视频到AI语音交互接口:', videoUrl);
|
|
|
|
|
@@ -2682,32 +2682,29 @@ export default {
|
|
|
|
|
|
// 获取用户信息和租户ID
|
|
|
const tenant_id = uni.getStorageSync('tenant_id') || '1';
|
|
|
- const userInfo = uni.getStorageSync('userInfo');
|
|
|
- const openid = userInfo ? (JSON.parse(userInfo).openid || '') : '';
|
|
|
-
|
|
|
- // 检查环境
|
|
|
- const systemInfo = uni.getSystemInfoSync();
|
|
|
- const isMiniProgram = systemInfo.uniPlatform && systemInfo.uniPlatform.startsWith('mp-');
|
|
|
+ const application_id = uni.getStorageSync('appId') || '98'; // 默认为98(报告)
|
|
|
|
|
|
// 准备请求数据
|
|
|
const requestData = {
|
|
|
- url: videoUrl,
|
|
|
+ voice_url: videoUrl,
|
|
|
tenant_id: tenant_id,
|
|
|
- /* openid: openid,
|
|
|
- application_id: uni.getStorageSync('appId') || '',
|
|
|
- has_audio: true, // 明确标记包含音频
|
|
|
- audio_format: 'mp4', // 指定音频格式
|
|
|
- duration: this.recordingTimerCount || 0 // 添加录制时长 */
|
|
|
+ application_id: application_id,
|
|
|
+ scene_type: 'interview', // 场景类型:面试
|
|
|
+ voice_type: 'longxiaoxia' // 角色:龙小侠
|
|
|
};
|
|
|
|
|
|
+ // 检查环境
|
|
|
+ const systemInfo = uni.getSystemInfoSync();
|
|
|
+ const isMiniProgram = systemInfo.uniPlatform && systemInfo.uniPlatform.startsWith('mp-');
|
|
|
+
|
|
|
if (isMiniProgram) {
|
|
|
// 小程序环境使用 uni.request
|
|
|
uni.request({
|
|
|
- url: `${apiBaseUrl}/api/voice_ai_interaction`,
|
|
|
+ url: `${apiBaseUrl}/api/system/voice/mcp/interaction`, // 使用新的接口地址
|
|
|
method: 'POST',
|
|
|
data: requestData,
|
|
|
header: {
|
|
|
- 'content-type': 'application/x-www-form-urlencoded'
|
|
|
+ 'content-type': 'application/json' // 修改为JSON格式
|
|
|
},
|
|
|
success: (res) => {
|
|
|
this.handleAiInteractionResponse(res.data);
|
|
@@ -2717,15 +2714,11 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
- // H5/App环境使用 FormData 和 XMLHttpRequest
|
|
|
- const formData = new FormData();
|
|
|
- for (const key in requestData) {
|
|
|
- formData.append(key, requestData[key]);
|
|
|
- }
|
|
|
-
|
|
|
+ // H5/App环境使用 XMLHttpRequest
|
|
|
const xhr = new XMLHttpRequest();
|
|
|
- xhr.open('POST', `${apiBaseUrl}/api/voice_ai_interaction`, true);
|
|
|
+ xhr.open('POST', `${apiBaseUrl}/api/system/voice/mcp/interaction`, true);
|
|
|
xhr.timeout = 60000; // 60秒超时
|
|
|
+ xhr.setRequestHeader('Content-Type', 'application/json');
|
|
|
|
|
|
xhr.onload = () => {
|
|
|
if (xhr.status === 200) {
|
|
@@ -2749,7 +2742,8 @@ export default {
|
|
|
this.handleAiInteractionError({ errMsg: '请求超时' });
|
|
|
};
|
|
|
|
|
|
- xhr.send(formData);
|
|
|
+ // 发送JSON格式的数据
|
|
|
+ xhr.send(JSON.stringify(requestData));
|
|
|
}
|
|
|
},
|
|
|
|