Commit 60f2ba02 by 张立顺

Merge branch 'develop' into SAAS+V4.43-0807

2 parents 610cd2b4 b660199c
......@@ -36,7 +36,7 @@ if (systemInfo.platform != "devtools") {
case "develop":
break;
case "trial":
index = manual ? index : 2;
index = manual ? index : 4;
break;
case "release":
index = release ? index : 3;
......@@ -95,7 +95,6 @@ export const dsnUrl =
export const ImgUrl =
"https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat";
export const ossConfig = {
// 请求域名 格式:https://xxx.xxx.com
HTTP_REQUEST_URL: "http://127.0.0.1:8000/api",
......@@ -113,5 +112,5 @@ export const ossConfig = {
};
export const bytedanceConfig = {
url: 'https://openspeech.bytedance.com/api/v1/tts'
}
url: "https://openspeech.bytedance.com/api/v1/tts",
};
......@@ -11,7 +11,8 @@ const VOICE = {
let timer = null;
let duration = 0;
import aiApi from "../../../aiApi";
const linkChainList = [{
const linkChainList = [
{
id: 1,
name: "接待",
iconUrl: "icon-reception",
......@@ -66,7 +67,7 @@ Page({
},
getHistoryAll() {
const audioBox = this.selectComponent("#audioBox");
return audioBox.getList('');
return audioBox.getList("");
},
// 结束,查看报告
toResult() {
......@@ -80,7 +81,7 @@ Page({
list.forEach((i) => {
if (i.role == 2) {
isJump = false;
Sentences = [...Sentences, ...i.Sentences ? i.Sentences : []]
Sentences = [...Sentences, ...(i.Sentences ? i.Sentences : [])];
}
});
if (isJump) {
......@@ -95,29 +96,32 @@ Page({
return;
}
this.setData({
isVisible: true
})
isVisible: true,
});
},
handleCancel() {
this.setData({
isVisible: false
})
isVisible: false,
});
},
handleSure() {
const history_message = this.getHistoryAll();
const audioBox = this.selectComponent("#audioBox");
const chatList = JSON.stringify(audioBox.data.list);
wx.setStorageSync("chatList", chatList);
const {
batch_id,
roleType,
step,
sparringTaskId,
entry
} = this.data;
console.log(entry)
wx.setStorageSync("history_message", history_message);
const { batch_id, roleType, step, sparringTaskId, entry } = this.data;
// wx.$router.go("/packageEquity/pages/aiCheck/result/result", {
// roleType,
// duration,
// history_message,
// batch_id,
// sparringLink: step,
// sparringTaskId,
// entry
// })
wx.redirectTo({
url: `/packageEquity/pages/aiCheck/result/result?roleType=${roleType}&duration=${duration}&history_message=${history_message}&batch_id=${batch_id}&sparringLink=${step}&sparringTaskId=${sparringTaskId}&entry=${entry}`,
url: `/packageEquity/pages/aiCheck/result/result?roleType=${roleType}&duration=${duration}&batch_id=${batch_id}&sparringLink=${step}&sparringTaskId=${sparringTaskId}&entry=${entry}`,
});
},
toBottom() {
......@@ -140,10 +144,7 @@ Page({
},
//选择攻防话术
async handleScript() {
const {
attackScript,
scriptList
} = this.data;
const { attackScript, scriptList } = this.data;
const audioBox = this.selectComponent("#audioBox");
const list = audioBox.data.list;
let isCan = true;
......@@ -160,17 +161,18 @@ Page({
const addVal = {
role: 1,
content: "",
openAudio: false
openAudio: false,
};
audioBox.addList(addVal, 1);
const index = Math.floor(Math.random() * 3);
const index = Math.floor(Math.random() * scriptList.length);
const message = scriptList[index].content;
const Phrases = await aiApi.getPhrases({
message
})
const content = Phrases.similar_words
message,
});
const content = Phrases.similar_words;
this.data.isSend = true;
audioBox.setList({
audioBox.setList(
{
content,
times: Math.ceil(content.length / 4),
spkTime: new Date().format("yyyy-MM-dd hh:mm:ss"),
......@@ -250,11 +252,7 @@ Page({
}
},
send(e) {
const {
result: content,
filePath,
times
} = e.detail;
const { result: content, filePath, times } = e.detail;
console.log(filePath);
const addVal = {
role: 2,
......@@ -269,7 +267,8 @@ Page({
const audioBox = this.selectComponent("#audioBox");
const idx = audioBox.data.list.length;
audioBox.addList(addVal);
this.setData({
this.setData(
{
inspirationContent: "",
showSpeechPopup: false,
},
......@@ -291,13 +290,8 @@ Page({
},
//获取改进建议和润色表达
getEnhancement(last_message, idx, retryCount = 0) {
const {
batch_id
} = this.data;
const {
uuid,
name
} = wx.$util.getUserInfo();
const { batch_id } = this.data;
const { uuid, name } = wx.$util.getUserInfo();
aiApi
.enhancement({
last_message,
......@@ -320,25 +314,25 @@ Page({
}
);
const audioBox = this.selectComponent("#audioBox");
audioBox.setSuggest({
audioBox.setSuggest(
{
loading: false,
refine_the_expression,
suggestions_for_improvement,
},
idx
);
}).catch(e => {
if (retryCount < 1) { // 如果重试次数小于1,则重试一次
})
.catch((e) => {
if (retryCount < 1) {
// 如果重试次数小于1,则重试一次
this.getEnhancement(last_message, idx, retryCount + 1);
}
wx.$sendSentry(name + '获取改进建议和润色表达' + JSON.stringify(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);
},
......@@ -347,13 +341,8 @@ 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({
......@@ -363,16 +352,11 @@ 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({
history_message,
......@@ -380,7 +364,7 @@ Page({
step,
uuid,
inspiration: "",
user_info
user_info,
})
.then((res) => {
this.setData({
......@@ -405,15 +389,13 @@ Page({
const addVal = {
role: 1,
openAudio: false,
content: ""
content: "",
};
const audioBox = this.selectComponent("#audioBox");
if (retryCount == 0) {
audioBox.addList(addVal);
}
const {
uuid
} = wx.$util.getUserInfo();
const { uuid } = wx.$util.getUserInfo();
aiApi
.sparring({
person_type,
......@@ -429,15 +411,11 @@ Page({
round,
})
.then((res) => {
const {
sale_message,
round,
defense_step,
step: next_step
} = res;
console.log('batch_id', batch_id, 'uuid', uuid)
audioBox.setList({
content: sale_message.replace(/,/g, ','),
const { sale_message, round, defense_step, step: next_step } = res;
console.log("batch_id", batch_id, "uuid", uuid);
audioBox.setList(
{
content: sale_message.replace(/,/g, ","),
times: Math.ceil(sale_message.length / 4),
spkTime: new Date().format("yyyy-MM-dd hh:mm:ss"),
},
......@@ -458,19 +436,17 @@ Page({
defense_step,
step: next_step,
});
}).catch(e => {
if (retryCount < 1) { // 如果重试次数小于1,则重试一次
})
.catch((e) => {
if (retryCount < 1) {
// 如果重试次数小于1,则重试一次
this.getSparring(user_message, retryCount + 1);
}
});
},
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,
......@@ -482,9 +458,7 @@ Page({
wx.$util.showToast("AI还未回复");
return;
}
const {
speakLoading
} = this.data;
const { speakLoading } = this.data;
if (speakLoading) return;
this.setData({
speakLoading: true,
......@@ -550,28 +524,22 @@ Page({
*/
async onLoad(options) {
this.getIsPlay();
let {
roleType: type,
stage,
roleName: name,
isDemo,
entry
} = options;
let { roleType: type, stage, roleName: name, isDemo, entry } = options;
let params = {
roleType: type,
};
if (name) {
params = {
roleName: name.replace('客户', ''),
roleName: name.replace("客户", ""),
};
this.setData({
entry: 'other'
})
entry: "other",
});
}
if (entry == 'other') {
if (entry == "other") {
this.setData({
entry: 'other'
})
entry: "other",
});
}
const roleInfo = await carLifeApi.sparringRole({
currentPage: 1,
......@@ -595,7 +563,7 @@ Page({
stage: findChain.name,
step: findChain.type,
avatar,
isDemo: isDemo === 'true',
isDemo: isDemo === "true",
person_type,
voice: VOICE[roleType],
roleDesc: findChain.desc,
......@@ -606,16 +574,17 @@ Page({
});
},
async getIsPlay() {
const {
merchantId,
uuid
} = wx.$util.getUserInfo();
const { merchantId, uuid } = wx.$util.getUserInfo();
const res = await aiApi.setSparringVerify({
staffUuid: uuid,
yqMerchantId: merchantId,
});
console.log(
res.data.sparringTaskId,
"sparringTaskIdsparringTaskIdsparringTaskId"
);
this.setData({
sparringTaskId: res.data.sparringTaskId
sparringTaskId: res.data.sparringTaskId,
});
},
//获取攻防话术
......@@ -640,21 +609,23 @@ Page({
this.deleteAudio();
wx.setKeepScreenOn({
keepScreenOn: false,
fail() { //如果失败 再进行调用
fail() {
//如果失败 再进行调用
wx.setKeepScreenOn({
keepScreenOn: false
keepScreenOn: false,
});
}
},
});
},
onShow: function () {
wx.setKeepScreenOn({
keepScreenOn: true,
fail() { //如果失败 再进行调用
fail() {
//如果失败 再进行调用
wx.setKeepScreenOn({
keepScreenOn: true
keepScreenOn: true,
});
}
},
});
},
deleteAudio() {
......@@ -669,4 +640,4 @@ Page({
}
});
},
});
\ No newline at end of file
});
......@@ -2,7 +2,7 @@
<block wx:if="{{flag}}">
<block wx:if="{{dialogueList.length}}">
<scroll-view class="scroll-view" enhanced scroll-y
scroll-into-view="{{toId}}" show-scrollbar="{{false}}" bindtouchstart="touchstart" bindtouchend="touchend">
scroll-into-view="{{toId}}" show-scrollbar="{{false}}" bindtouchstart="touchstart" bindtouchend="touchend" scroll-with-animation>
<block wx:for="{{dialogueList}}" wx:key="index">
<view class="item {{activeId == item.text_id?'active':''}} {{item.conversationCheckDetailDTO || item.defenceDetail ? 'hide-margin' :''}}" id="{{item.text_id}}" data-click bindtap="seekPlay" data-item="{{item}}" data-index="{{index}}">
<block wx:if="{{item.visible}}">
......
......@@ -89,9 +89,9 @@ const domain_items = {
merchants: "https://commodity.glsx.com.cn",
},
preRelease: {
dj: "http://dj.beta.glsx.com.cn",
dj: "https://dj.beta.glsx.com.cn",
scrm: "https://scrm.beta.glsx.com.cn",
merchants: "http://rop-merchant.beta.glsx.com.cn",
merchants: "https://rop-merchant.beta.glsx.com.cn",
AI: 'https://aipractice.beta.glsx.com.cn',
},
cdptest: {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!