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 55b85a53
authored
May 10, 2024
by
前端
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fixed
1 parent
18542391
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
30 deletions
packageEquity/pages/aiCheck/chat/chat.js
packageEquity/pages/aiCheck/chat/chat.wxml
utils/request/request.js
packageEquity/pages/aiCheck/chat/chat.js
View file @
55b85a5
...
...
@@ -122,14 +122,22 @@ Page({
this
.
setData
({
chatList
,
showSpeechPopup
:
false
},()
=>
{
this
.
getSparring
(
content
);
this
.
getEnhancement
(
content
);
})
this
.
getSparring
(
content
);
this
.
getEnhancement
(
content
);
},
//获取改进建议和润色表达
getEnhancement
(
last_message
)
{
aiApi
.
enhancement
({
last_message
}).
then
(
res
=>
{
console
.
log
(
res
)
const
{
refine_the_expression
,
suggestions_for_improvement
}
=
res
;
const
{
chatList
}
=
this
.
data
;
const
len
=
chatList
.
length
-
2
;
chatList
[
len
].
loading
=
false
;
chatList
[
len
].
refine_the_expression
=
refine_the_expression
chatList
[
len
].
suggestions_for_improvement
=
suggestions_for_improvement
this
.
setData
({
chatList
})
})
},
//获取防守建议
...
...
@@ -138,38 +146,51 @@ Page({
this
.
setData
({
scriptList
:[
1
,
2
,
3
]})
})
},
getHistory
()
{
const
{
chatList
}
=
this
.
data
;
let
history
=
''
chatList
.
forEach
(
item
=>
{
if
(
item
.
role
==
1
)
{
history
+=
`客户说:
${
item
.
content
}
`
}
else
{
history
+=
`销售说:
${
item
.
content
}
`
}
})
return
history
},
//获取灵感建议
getInspiration
()
{
aiApi
.
inspiration
({}).
then
(
res
=>
{
const
{
step
}
=
this
.
data
const
history_message
=
this
.
getHistory
()
aiApi
.
inspiration
({
history_message
,
step
,
inspiration
:
''
}).
then
(
res
=>
{
this
.
setData
({
inspirationContent
:
'当然,我很高兴能为您提供帮助。我们的新款车型性能优越,安全性能出色,而且售后服务也非常完善。您可以放心购买,我们会为您提供最优质的购车体验。您有什么特别需求或偏好吗?'
inspirationContent
:
res
})
})
},
//提供相应的建议
getSparring
(
user_message
)
{
const
{
step
}
=
this
.
data
let
history_message
if
(
!
user_message
)
{
history_message
=
WELCOME
}
else
{
history_message
=
'5'
}
const
{
step
,
chatList
}
=
this
.
data
console
.
log
(
chatList
)
let
history_message
=
this
.
getHistory
()
chatList
.
push
({
role
:
1
,
content
:
''
,
})
this
.
setData
({
chatList
})
aiApi
.
sparring
({
user_message
,
history_message
,
step
,
main_point
:
4
,
defense_step
:
4
,
main_point
:
"0"
,
defense_step
:
0
,
round
:
0
}).
then
(
res
=>
{
const
{
chatList
}
=
this
.
data
;
const
len
=
chatList
.
length
-
1
const
{
sale_message
}
=
res
chatList
.
push
({
role
:
1
,
content
:
sale_message
,
time
:
Math
.
floor
(
sale_message
.
length
/
3
)
})
chatList
[
len
].
content
=
sale_message
chatList
[
len
].
time
=
Math
.
floor
(
sale_message
.
length
/
3
)
this
.
setData
({
chatList
})
})
},
...
...
@@ -207,7 +228,6 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad
(
options
)
{
this
.
getSparring
(
''
)
},
/**
...
...
packageEquity/pages/aiCheck/chat/chat.wxml
View file @
55b85a5
...
...
@@ -19,7 +19,7 @@
</view>
</view>
<view class="chat-item" wx:for="{{chatList}}">
<view class="chat-left" wx:if="{{item.role == 1}}">
<view class="chat-left" wx:if="{{item.role == 1
&& item.content
}}">
<gl-image class="avatar-icon" src="/aiCheck/setting-icon.png"></gl-image>
<view class="chat-box">
<audio-tts audioInfo="{{item}}"></audio-tts>
...
...
@@ -53,7 +53,7 @@
<gl-image class="suggest-icon" src="/aiCheck/suggest-icon.png"></gl-image>
改进建议
</view>
<view class="text">
销售时应该更多地关注客户的需求和偏好,建议在推荐产品时提供更多相关信息,以便客户做出更好的决定。另外,可以通过问一些问题来了解客户的具体需求。
</view>
<view class="text">
{{item.suggestions_for_improvement}}
</view>
</view>
<view class="line"></view>
<view class="polish">
...
...
@@ -61,7 +61,7 @@
<gl-image class="suggest-icon" src="/aiCheck/polish-icon.png"></gl-image>
润色表达
</view>
<view class="text">
你好,欢迎来到我们店里!在为您推荐产品之前,我想了解一下您对新车的具体需求和偏好,比如您对车辆功能、价格范围、品牌偏好等方面有什么考虑吗?
</view>
<view class="text">
{{item.refine_the_expression}}
</view>
</view>
</view>
...
...
utils/request/request.js
View file @
55b85a5
...
...
@@ -31,13 +31,9 @@ class Request {
data
=
_this
.
getData
(
data
,
method
,
noSignAttr
,
domainName
==
'merchants'
)
url
=
`
${
domain
[
domainName
]}${
requestPath
||
path
}
?method=
${
method
}
`
;
}
else
{
const
queryString
=
qs
.
stringify
(
data
,
{
arrayFormat
:
'indices'
,
allowDots
:
true
,
encodeValuesOnly
:
true
})
url
=
`
${
domain
[
domainName
]}${
requestPath
||
path
}
?
${
queryString
}
`
data
=
null
header
=
{
'content-type'
:
'application/json'
}
}
// console.log('reqData',data?.sessionId);
// delete
...
...
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