Commit 60f2ba02 by 张立顺

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

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