Commit fe94172b by 前端

添加日志

1 parent f80f86bc
//app.js
// 初始化sentry
import sentryInit from '~/utils/sentryConfig/sentryInit'
sentryInit()
const sentry = sentryInit()
wx.$sendSentry = function (e) {
sentry.captureException(e);
};
// 解决showLoading 和 showToast显示异常的问题
import fixWxShowToast from './utils/lib/fixWxShowToast'
fixWxShowToast()
......
......@@ -11,8 +11,7 @@ const VOICE = {
let timer = null;
let duration = 0;
import aiApi from "../../../aiApi";
const linkChainList = [
{
const linkChainList = [{
id: 1,
name: "接待",
iconUrl: "icon-reception",
......@@ -96,7 +95,12 @@ Page({
}
const chatList = JSON.stringify(audioBox.data.list);
wx.setStorageSync("chatList", chatList);
const { batch_id, roleType, step, sparringTaskId } = this.data;
const {
batch_id,
roleType,
step,
sparringTaskId
} = this.data;
wx.redirectTo({
url: `/packageEquity/pages/aiCheck/result/result?roleType=${roleType}&duration=${duration}&history_message=${history_message}&batch_id=${batch_id}&sparringLink=${step}&sparringTaskId=${sparringTaskId}`,
});
......@@ -121,7 +125,10 @@ Page({
},
//选择攻防话术
handleScript() {
const { attackScript, scriptList } = this.data;
const {
attackScript,
scriptList
} = this.data;
const index = Math.floor(Math.random() * 3);
const content = scriptList[index].content;
const addVal = {
......@@ -217,7 +224,11 @@ Page({
}
},
send(e) {
const { result: content, filePath, times } = e.detail;
const {
result: content,
filePath,
times
} = e.detail;
console.log(filePath);
const addVal = {
role: 2,
......@@ -232,8 +243,7 @@ Page({
const audioBox = this.selectComponent("#audioBox");
const idx = audioBox.data.list.length;
audioBox.addList(addVal);
this.setData(
{
this.setData({
inspirationContent: "",
showSpeechPopup: false,
},
......@@ -247,12 +257,21 @@ Page({
this.setData({
showSpeechPopup: false,
});
// this.send({detail:{result:'你好欢迎光临'}})
this.send({
detail: {
result: '你好欢迎光临'
}
})
},
//获取改进建议和润色表达
getEnhancement(last_message, idx) {
const { batch_id } = this.data;
const { uuid } = wx.$util.getUserInfo();
const {
batch_id
} = this.data;
const {
uuid,
name
} = wx.$util.getUserInfo();
aiApi
.enhancement({
last_message,
......@@ -275,18 +294,22 @@ Page({
}
);
const audioBox = this.selectComponent("#audioBox");
audioBox.setSuggest(
{
audioBox.setSuggest({
loading: false,
refine_the_expression,
suggestions_for_improvement,
},
idx
);
}).catch(e => {
wx.$sendSentry(name+'获取改进建议和润色表达' + JSON.stringify(e))
});
},
getHistory() {
let { step, defenseIndex } = this.data;
let {
step,
defenseIndex
} = this.data;
const audioBox = this.selectComponent("#audioBox");
return audioBox.getList(step, defenseIndex);
},
......@@ -295,8 +318,13 @@ Page({
* 如果进入攻防状态(defense),直接拿对应的灵感
*/
getInspiration() {
const { step, inspirationContent, roleInspiration, attackScript } =
this.data;
const {
step,
inspirationContent,
roleInspiration,
attackScript
} =
this.data;
console.log(inspirationContent, roleInspiration, "inspirationContent");
if (step == "defense") {
this.setData({
......@@ -306,10 +334,15 @@ Page({
}
if (inspirationContent) return;
const history_message = this.getHistory();
const { batch_id,roleDetail } = this.data;
const { uuid } = wx.$util.getUserInfo();
const {
batch_id,
roleDetail
} = this.data;
const {
uuid
} = wx.$util.getUserInfo();
const user_info = JSON.stringify({
user_sex: roleDetail.replace(/.*性别:(.).*/,'$1')
user_sex: roleDetail.replace(/.*性别:(.).*/, '$1')
})
aiApi
.inspiration({
......@@ -348,7 +381,9 @@ Page({
};
const audioBox = this.selectComponent("#audioBox");
audioBox.addList(addVal);
const { uuid } = wx.$util.getUserInfo();
const {
uuid
} = wx.$util.getUserInfo();
aiApi
.sparring({
person_type,
......@@ -364,10 +399,14 @@ Page({
round,
})
.then((res) => {
const { sale_message, round, defense_step, step: next_step } = res;
console.log('batch_id',batch_id,'uuid',uuid)
audioBox.setList(
{
const {
sale_message,
round,
defense_step,
step: next_step
} = res;
console.log('batch_id', batch_id, 'uuid', uuid)
audioBox.setList({
content: sale_message,
times: Math.ceil(sale_message.length / 4),
},
......@@ -391,8 +430,12 @@ Page({
});
},
handleShow(e) {
const { index } = e.currentTarget.dataset;
const { chatList } = this.data;
const {
index
} = e.currentTarget.dataset;
const {
chatList
} = this.data;
chatList[index].show = true;
this.setData({
chatList,
......@@ -404,7 +447,9 @@ Page({
wx.$util.showToast("AI还未回复");
return;
}
const { speakLoading } = this.data;
const {
speakLoading
} = this.data;
if (speakLoading) return;
this.setData({
speakLoading: true,
......@@ -470,7 +515,12 @@ Page({
*/
async onLoad(options) {
this.getIsPlay();
let { roleType: type, stage, roleName: name,isDemo } = options;
let {
roleType: type,
stage,
roleName: name,
isDemo
} = options;
let params = {
roleType: type,
};
......@@ -512,14 +562,21 @@ Page({
});
},
async getIsPlay() {
const { merchantId, uuid } = wx.$util.getUserInfo();
const {
merchantId,
uuid
} = wx.$util.getUserInfo();
const res = await aiApi.setSparringVerify({
staffUuid: uuid,
yqMerchantId: merchantId,
});
this.setData({ sparringTaskId: res.data.sparringTaskId });
this.setData({
sparringTaskId: res.data.sparringTaskId
});
if (!res.data.sparringAllow) {
this.setData({ isVisible: true });
this.setData({
isVisible: true
});
return;
}
},
......@@ -545,21 +602,21 @@ Page({
this.deleteAudio();
wx.setKeepScreenOn({
keepScreenOn: false,
fail() {//如果失败 再进行调用
wx.setKeepScreenOn({
keepScreenOn: false
});
}
fail() { //如果失败 再进行调用
wx.setKeepScreenOn({
keepScreenOn: false
});
}
});
},
onShow:function(){
onShow: function () {
wx.setKeepScreenOn({
keepScreenOn: true,
fail() {//如果失败 再进行调用
wx.setKeepScreenOn({
keepScreenOn: true
});
}
fail() { //如果失败 再进行调用
wx.setKeepScreenOn({
keepScreenOn: true
});
}
});
},
deleteAudio() {
......@@ -574,4 +631,4 @@ Page({
}
});
},
});
});
\ No newline at end of file
......@@ -81,6 +81,10 @@ Component({
},
onSrStart: async function () {
if (!this.data.sr) {
const {
name
} = wx.$util.getUserInfo();
wx.$sendSentry(name+'语音识别连接失败')
console.log("sr is null")
return
}
......@@ -108,6 +112,7 @@ Component({
await sr.start(param)
this.data.srStart = true
} catch (e) {
wx.$sendSentry('语音转文字连接失败' + e)
console.log("start failed:" + e)
return
}
......@@ -147,6 +152,7 @@ Component({
})
wx.getRecorderManager().onError((res) => {
console.log("recording failed:" + res)
wx.$sendSentry('语音转文字失败' + res)
// this.connectSr()
})
try {
......
......@@ -54,7 +54,7 @@ export const definitionEmoji = [{
text: '清晰'
}]
export const activeEmoji = [{
text: '恶劣'
text: '消极'
}, {
text: '冷淡'
}, {
......
......@@ -9,4 +9,5 @@ export default function sentryInit() {
Sentry.init({
dsn: dsnUrl
})
return Sentry
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!