Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
dj-car-boutique-work-wechat
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
1
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit fe94172b
authored
Jul 24, 2024
by
前端
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
添加日志
1 parent
f80f86bc
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
101 additions
and
34 deletions
app.js
packageEquity/pages/aiCheck/chat/chat.js
packageEquity/pages/aiCheck/components/SpeechPopup/SpeechPopup.js
packageEquity/pages/aiCheck/contant.js
utils/sentryConfig/sentryInit.js
app.js
View file @
fe94172
//app.js
//app.js
// 初始化sentry
// 初始化sentry
import
sentryInit
from
'~/utils/sentryConfig/sentryInit'
import
sentryInit
from
'~/utils/sentryConfig/sentryInit'
sentryInit
()
const
sentry
=
sentryInit
()
wx
.
$sendSentry
=
function
(
e
)
{
sentry
.
captureException
(
e
);
};
// 解决showLoading 和 showToast显示异常的问题
// 解决showLoading 和 showToast显示异常的问题
import
fixWxShowToast
from
'./utils/lib/fixWxShowToast'
import
fixWxShowToast
from
'./utils/lib/fixWxShowToast'
fixWxShowToast
()
fixWxShowToast
()
...
...
packageEquity/pages/aiCheck/chat/chat.js
View file @
fe94172
...
@@ -11,8 +11,7 @@ const VOICE = {
...
@@ -11,8 +11,7 @@ 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"
,
...
@@ -96,7 +95,12 @@ Page({
...
@@ -96,7 +95,12 @@ Page({
}
}
const
chatList
=
JSON
.
stringify
(
audioBox
.
data
.
list
);
const
chatList
=
JSON
.
stringify
(
audioBox
.
data
.
list
);
wx
.
setStorageSync
(
"chatList"
,
chatList
);
wx
.
setStorageSync
(
"chatList"
,
chatList
);
const
{
batch_id
,
roleType
,
step
,
sparringTaskId
}
=
this
.
data
;
const
{
batch_id
,
roleType
,
step
,
sparringTaskId
}
=
this
.
data
;
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
}
`
,
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({
...
@@ -121,7 +125,10 @@ Page({
},
},
//选择攻防话术
//选择攻防话术
handleScript
()
{
handleScript
()
{
const
{
attackScript
,
scriptList
}
=
this
.
data
;
const
{
attackScript
,
scriptList
}
=
this
.
data
;
const
index
=
Math
.
floor
(
Math
.
random
()
*
3
);
const
index
=
Math
.
floor
(
Math
.
random
()
*
3
);
const
content
=
scriptList
[
index
].
content
;
const
content
=
scriptList
[
index
].
content
;
const
addVal
=
{
const
addVal
=
{
...
@@ -217,7 +224,11 @@ Page({
...
@@ -217,7 +224,11 @@ Page({
}
}
},
},
send
(
e
)
{
send
(
e
)
{
const
{
result
:
content
,
filePath
,
times
}
=
e
.
detail
;
const
{
result
:
content
,
filePath
,
times
}
=
e
.
detail
;
console
.
log
(
filePath
);
console
.
log
(
filePath
);
const
addVal
=
{
const
addVal
=
{
role
:
2
,
role
:
2
,
...
@@ -232,8 +243,7 @@ Page({
...
@@ -232,8 +243,7 @@ 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
,
},
},
...
@@ -247,12 +257,21 @@ Page({
...
@@ -247,12 +257,21 @@ Page({
this
.
setData
({
this
.
setData
({
showSpeechPopup
:
false
,
showSpeechPopup
:
false
,
});
});
// this.send({detail:{result:'你好欢迎光临'}})
this
.
send
({
detail
:
{
result
:
'你好欢迎光临'
}
})
},
},
//获取改进建议和润色表达
//获取改进建议和润色表达
getEnhancement
(
last_message
,
idx
)
{
getEnhancement
(
last_message
,
idx
)
{
const
{
batch_id
}
=
this
.
data
;
const
{
const
{
uuid
}
=
wx
.
$util
.
getUserInfo
();
batch_id
}
=
this
.
data
;
const
{
uuid
,
name
}
=
wx
.
$util
.
getUserInfo
();
aiApi
aiApi
.
enhancement
({
.
enhancement
({
last_message
,
last_message
,
...
@@ -275,18 +294,22 @@ Page({
...
@@ -275,18 +294,22 @@ 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
=>
{
wx
.
$sendSentry
(
name
+
'获取改进建议和润色表达'
+
JSON
.
stringify
(
e
))
});
});
},
},
getHistory
()
{
getHistory
()
{
let
{
step
,
defenseIndex
}
=
this
.
data
;
let
{
step
,
defenseIndex
}
=
this
.
data
;
const
audioBox
=
this
.
selectComponent
(
"#audioBox"
);
const
audioBox
=
this
.
selectComponent
(
"#audioBox"
);
return
audioBox
.
getList
(
step
,
defenseIndex
);
return
audioBox
.
getList
(
step
,
defenseIndex
);
},
},
...
@@ -295,7 +318,12 @@ Page({
...
@@ -295,7 +318,12 @@ Page({
* 如果进入攻防状态(defense),直接拿对应的灵感
* 如果进入攻防状态(defense),直接拿对应的灵感
*/
*/
getInspiration
()
{
getInspiration
()
{
const
{
step
,
inspirationContent
,
roleInspiration
,
attackScript
}
=
const
{
step
,
inspirationContent
,
roleInspiration
,
attackScript
}
=
this
.
data
;
this
.
data
;
console
.
log
(
inspirationContent
,
roleInspiration
,
"inspirationContent"
);
console
.
log
(
inspirationContent
,
roleInspiration
,
"inspirationContent"
);
if
(
step
==
"defense"
)
{
if
(
step
==
"defense"
)
{
...
@@ -306,10 +334,15 @@ Page({
...
@@ -306,10 +334,15 @@ Page({
}
}
if
(
inspirationContent
)
return
;
if
(
inspirationContent
)
return
;
const
history_message
=
this
.
getHistory
();
const
history_message
=
this
.
getHistory
();
const
{
batch_id
,
roleDetail
}
=
this
.
data
;
const
{
const
{
uuid
}
=
wx
.
$util
.
getUserInfo
();
batch_id
,
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
({
...
@@ -348,7 +381,9 @@ Page({
...
@@ -348,7 +381,9 @@ Page({
};
};
const
audioBox
=
this
.
selectComponent
(
"#audioBox"
);
const
audioBox
=
this
.
selectComponent
(
"#audioBox"
);
audioBox
.
addList
(
addVal
);
audioBox
.
addList
(
addVal
);
const
{
uuid
}
=
wx
.
$util
.
getUserInfo
();
const
{
uuid
}
=
wx
.
$util
.
getUserInfo
();
aiApi
aiApi
.
sparring
({
.
sparring
({
person_type
,
person_type
,
...
@@ -364,10 +399,14 @@ Page({
...
@@ -364,10 +399,14 @@ Page({
round
,
round
,
})
})
.
then
((
res
)
=>
{
.
then
((
res
)
=>
{
const
{
sale_message
,
round
,
defense_step
,
step
:
next_step
}
=
res
;
const
{
console
.
log
(
'batch_id'
,
batch_id
,
'uuid'
,
uuid
)
sale_message
,
audioBox
.
setList
(
round
,
{
defense_step
,
step
:
next_step
}
=
res
;
console
.
log
(
'batch_id'
,
batch_id
,
'uuid'
,
uuid
)
audioBox
.
setList
({
content
:
sale_message
,
content
:
sale_message
,
times
:
Math
.
ceil
(
sale_message
.
length
/
4
),
times
:
Math
.
ceil
(
sale_message
.
length
/
4
),
},
},
...
@@ -391,8 +430,12 @@ Page({
...
@@ -391,8 +430,12 @@ Page({
});
});
},
},
handleShow
(
e
)
{
handleShow
(
e
)
{
const
{
index
}
=
e
.
currentTarget
.
dataset
;
const
{
const
{
chatList
}
=
this
.
data
;
index
}
=
e
.
currentTarget
.
dataset
;
const
{
chatList
}
=
this
.
data
;
chatList
[
index
].
show
=
true
;
chatList
[
index
].
show
=
true
;
this
.
setData
({
this
.
setData
({
chatList
,
chatList
,
...
@@ -404,7 +447,9 @@ Page({
...
@@ -404,7 +447,9 @@ Page({
wx
.
$util
.
showToast
(
"AI还未回复"
);
wx
.
$util
.
showToast
(
"AI还未回复"
);
return
;
return
;
}
}
const
{
speakLoading
}
=
this
.
data
;
const
{
speakLoading
}
=
this
.
data
;
if
(
speakLoading
)
return
;
if
(
speakLoading
)
return
;
this
.
setData
({
this
.
setData
({
speakLoading
:
true
,
speakLoading
:
true
,
...
@@ -470,7 +515,12 @@ Page({
...
@@ -470,7 +515,12 @@ Page({
*/
*/
async
onLoad
(
options
)
{
async
onLoad
(
options
)
{
this
.
getIsPlay
();
this
.
getIsPlay
();
let
{
roleType
:
type
,
stage
,
roleName
:
name
,
isDemo
}
=
options
;
let
{
roleType
:
type
,
stage
,
roleName
:
name
,
isDemo
}
=
options
;
let
params
=
{
let
params
=
{
roleType
:
type
,
roleType
:
type
,
};
};
...
@@ -512,14 +562,21 @@ Page({
...
@@ -512,14 +562,21 @@ Page({
});
});
},
},
async
getIsPlay
()
{
async
getIsPlay
()
{
const
{
merchantId
,
uuid
}
=
wx
.
$util
.
getUserInfo
();
const
{
merchantId
,
uuid
}
=
wx
.
$util
.
getUserInfo
();
const
res
=
await
aiApi
.
setSparringVerify
({
const
res
=
await
aiApi
.
setSparringVerify
({
staffUuid
:
uuid
,
staffUuid
:
uuid
,
yqMerchantId
:
merchantId
,
yqMerchantId
:
merchantId
,
});
});
this
.
setData
({
sparringTaskId
:
res
.
data
.
sparringTaskId
});
this
.
setData
({
sparringTaskId
:
res
.
data
.
sparringTaskId
});
if
(
!
res
.
data
.
sparringAllow
)
{
if
(
!
res
.
data
.
sparringAllow
)
{
this
.
setData
({
isVisible
:
true
});
this
.
setData
({
isVisible
:
true
});
return
;
return
;
}
}
},
},
...
@@ -545,17 +602,17 @@ Page({
...
@@ -545,17 +602,17 @@ 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
});
});
...
...
packageEquity/pages/aiCheck/components/SpeechPopup/SpeechPopup.js
View file @
fe94172
...
@@ -81,6 +81,10 @@ Component({
...
@@ -81,6 +81,10 @@ Component({
},
},
onSrStart
:
async
function
()
{
onSrStart
:
async
function
()
{
if
(
!
this
.
data
.
sr
)
{
if
(
!
this
.
data
.
sr
)
{
const
{
name
}
=
wx
.
$util
.
getUserInfo
();
wx
.
$sendSentry
(
name
+
'语音识别连接失败'
)
console
.
log
(
"sr is null"
)
console
.
log
(
"sr is null"
)
return
return
}
}
...
@@ -108,6 +112,7 @@ Component({
...
@@ -108,6 +112,7 @@ Component({
await
sr
.
start
(
param
)
await
sr
.
start
(
param
)
this
.
data
.
srStart
=
true
this
.
data
.
srStart
=
true
}
catch
(
e
)
{
}
catch
(
e
)
{
wx
.
$sendSentry
(
'语音转文字连接失败'
+
e
)
console
.
log
(
"start failed:"
+
e
)
console
.
log
(
"start failed:"
+
e
)
return
return
}
}
...
@@ -147,6 +152,7 @@ Component({
...
@@ -147,6 +152,7 @@ Component({
})
})
wx
.
getRecorderManager
().
onError
((
res
)
=>
{
wx
.
getRecorderManager
().
onError
((
res
)
=>
{
console
.
log
(
"recording failed:"
+
res
)
console
.
log
(
"recording failed:"
+
res
)
wx
.
$sendSentry
(
'语音转文字失败'
+
res
)
// this.connectSr()
// this.connectSr()
})
})
try
{
try
{
...
...
packageEquity/pages/aiCheck/contant.js
View file @
fe94172
...
@@ -54,7 +54,7 @@ export const definitionEmoji = [{
...
@@ -54,7 +54,7 @@ export const definitionEmoji = [{
text
:
'清晰'
text
:
'清晰'
}]
}]
export
const
activeEmoji
=
[{
export
const
activeEmoji
=
[{
text
:
'
恶劣
'
text
:
'
消极
'
},
{
},
{
text
:
'冷淡'
text
:
'冷淡'
},
{
},
{
...
...
utils/sentryConfig/sentryInit.js
View file @
fe94172
...
@@ -9,4 +9,5 @@ export default function sentryInit() {
...
@@ -9,4 +9,5 @@ export default function sentryInit() {
Sentry
.
init
({
Sentry
.
init
({
dsn
:
dsnUrl
dsn
:
dsnUrl
})
})
return
Sentry
}
}
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment