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 564248a6
authored
May 08, 2024
by
前端
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
重连
1 parent
7d521468
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
54 additions
and
27 deletions
config.js
packageEquity/pages/aiExcercise/list/components/input-box.js
packageEquity/pages/aiExcercise/list/components/input-box.wxml
packageEquity/pages/aiExcercise/list/list.js
packageEquity/pages/aiExcercise/list/list.sass
packageEquity/pages/aiExcercise/list/list.wxml
utils/aliyun/socket.js
config.js
View file @
564248a
...
...
@@ -51,9 +51,9 @@ if (systemInfo.platform != "devtools") {
export
const
env
=
envName
;
export
const
envIndex
=
index
;
export
const
ALIYUN
=
{
AKID
:
"LTAI
hu9ItBSzi16S
"
,
AKKEY
:
"
Esmj7USmypZPDtA7mPpAEkmcOtTLjx
"
,
APPKEY
:
"
7cJdzPPBWB9XmU6T
"
,
AKID
:
"LTAI
5tJday6R4sng1jgrgH3N
"
,
AKKEY
:
"
TWvwaQqwjxw7Tj7RlnTxyEXjOjQgFh
"
,
APPKEY
:
"
a1HmjrmQNv6yT8zb
"
,
URL
:
"wss://nls-gateway-cn-shanghai.aliyuncs.com/ws/v1"
,
};
const
createQuotedUrl
=
{
...
...
packageEquity/pages/aiExcercise/list/components/input-box.js
View file @
564248a
...
...
@@ -9,7 +9,13 @@ Component({
* 组件的属性列表
*/
properties
:
{
isSend
:
Boolean
isSend
:
{
type
:
Boolean
,
value
:
true
,
observer
:
function
(
n
)
{
this
.
setData
({
isClear
:
n
})
}
}
},
/**
...
...
@@ -147,8 +153,9 @@ Component({
this
.
data
.
sr
=
sr
},
sendMsg
()
{
this
.
triggerEvent
(
'send'
,
this
.
data
.
inputValue
)
this
.
setData
({
inputValue
:
''
})
const
{
isClear
}
=
this
.
data
;
this
.
triggerEvent
(
'send'
,
this
.
data
.
inputValue
);
if
(
isClear
)
this
.
setData
({
inputValue
:
''
})
},
input
(
e
)
{
let
{
value
:
inputValue
}
=
e
.
detail
...
...
packageEquity/pages/aiExcercise/list/components/input-box.wxml
View file @
564248a
...
...
@@ -4,7 +4,7 @@
<view class="input-icon">
<gl-image data-type="2" webp src="/equity/keyboard.png" bind:tap="tabType" />
</view>
<view class="input-s" bind:tap="onPress">
按住
说话</view>
<view class="input-s" bind:tap="onPress">
点击
说话</view>
</block>
<block wx:else>
<view class="input-icon">
...
...
packageEquity/pages/aiExcercise/list/list.js
View file @
564248a
...
...
@@ -81,9 +81,9 @@ Page({
taskStaffId
,
tryCount
,
user_tips
,
promptOnOff
:
promptOnOff
===
'true'
,
promptOnOff
:
promptOnOff
===
'true'
,
avatar
},
()
=>
{
},
()
=>
{
this
.
getChatH
()
})
WebSocketUtil
.
connect
(
`
${
scoket_url
}
/ai/sparring/
${
taskStaffId
}
_
${(
Math
.
random
()
+
''
).
slice
(
2
)}
`
,
()
=>
{
...
...
@@ -195,7 +195,15 @@ Page({
})
}
}
if
(
history
.
length
==
14
)
{
if
(
history
.
length
==
8
)
{
this
.
setData
({
contentList
:
[...
this
.
data
.
contentList
,
{
role
:
2
,
spkTime
:
new
Date
().
format
(
'yyyy-MM-dd hh:mm:ss'
),
content
:
item
}]
});
this
.
sparringCommit
()
return
}
...
...
@@ -286,13 +294,13 @@ Page({
JSON
.
stringify
({
type
,
question
:
question_d
,
history
:
JSON
.
stringify
([
i
%
2
==
0
?
{
history
:
JSON
.
stringify
([
...
history
,
i
%
2
==
0
?
{
role
:
'system'
,
content
:
`以女性的口吻回复,建议
${
i
+
45
}
个字以内`
}
:
{
role
:
'system'
,
content
:
`以男性的口吻回复,建议
${
i
+
45
}
个字以内`
}
,
...
history
])
}])
})
)
}
...
...
@@ -348,6 +356,10 @@ Page({
})
},
sparringCommit
()
{
this
.
setData
({
isEnd
:
true
,
promptOnOff
:
false
},()
=>
{
this
.
getChatH
();
})
const
history
=
[]
if
(
this
.
data
.
contentList
.
length
)
{
for
(
let
i
=
0
;
i
<
this
.
data
.
contentList
.
length
;
i
++
)
{
...
...
@@ -400,9 +412,6 @@ Page({
},
()
=>
{
this
.
showRemind
(
'结束提醒'
,
()
=>
{
this
.
sparringCommit
();
this
.
setData
({
isEnd
:
true
})
},
()
=>
{
console
.
log
(
this
)
});
...
...
@@ -457,11 +466,13 @@ Page({
promptOnOff
,
isEnd
}
=
_this
.
data
;
let
h1
=
240
,
h2
=
850
,
h3
=
370
if
(
isPad
)
{
h2
=
90
let
h1
=
240
,
h2
=
600
,
h3
=
104
if
(
isPad
)
{
h2
=
90
}
let
chat_H
=
`calc(100vh - var(--fontSize
${(
promptOnOff
?
0
:
-
h1
)
+
h2
+
(
isEnd
?
0
:
h3
)}
) - var(--envSafeAreaInsetBottom))`
;
let
chat_H
=
`calc(100vh - var(--fontSize
${(
promptOnOff
?
h1
:
0
)
+
h2
+
(
isEnd
?
0
:
h3
)}
) - var(--envSafeAreaInsetBottom))`
;
_this
.
setData
({
chat_H
})
...
...
packageEquity/pages/aiExcercise/list/list.sass
View file @
564248a
...
...
@@ -3,14 +3,16 @@ page {
background
:
#f7f8fa
;
}
.avatar-box
{
height
:
var
(
--
fontSize
75
0
)
;
height
:
var
(
--
fontSize
38
0
)
;
width
:
100%
;
position
:
fixed
;
top
:
var
(
--
fontSize90
)
;
top
:
var
(
--
fontSize180
)
;
background
:
#333333
;
left
:
0
;
text-align
:
center
;
.avatar
{
width
:
100%
;
height
:
100%
;
height
:
var
(
--
fontSize380
)
;
width
:
var
(
--
fontSize380
)
;
}
}
.camera-box
{
...
...
@@ -44,7 +46,7 @@ page {
position
:
fixed
;
left
:
0
;
width
:
100%
;
top
:
var
(
--
fontSize
84
0
)
;
top
:
var
(
--
fontSize
56
0
)
;
padding
:
var
(
--
fontSize24
)
0
;
padding-bottom
:
10rpx
;
.chat-item
{
...
...
packageEquity/pages/aiExcercise/list/list.wxml
View file @
564248a
...
...
@@ -55,7 +55,7 @@
</scroll-view>
</view>
<view class="input-box" wx:if="{{!isEnd}}">
<input-box bindsend="send" bind:speech="speech"></input-box>
<input-box bindsend="send" bind:speech="speech"
isSend="{{isSend}}"
></input-box>
</view>
<view class="tips-box" wx:if="{{promptOnOff && showTips && !isEnd}}">
...
...
utils/aliyun/socket.js
View file @
564248a
let
socket
=
null
;
let
connected
=
false
;
let
messageCallback
=
null
function
connect
(
url
,
callback
)
{
let
connected_url
=
null
function
connect
(
url
,
callback
,
msg
)
{
connected_url
=
url
socket
=
wx
.
connectSocket
({
url
:
url
url
:
connected_
url
});
socket
.
onOpen
(()
=>
{
connected
=
true
;
callback
&&
callback
()
if
(
msg
)
{
send
(
msg
)
}
});
socket
.
onClose
(()
=>
{
...
...
@@ -29,6 +34,8 @@ function send(message) {
socket
.
send
({
data
:
message
});
}
else
{
connect
(
connected_url
,
null
,
message
)
}
}
function
disconnect
()
{
...
...
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