Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
h5
/
salesgpt-project
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit a7f37904
authored
Mar 06, 2024
by
前端
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
优化推流
1 parent
a4f652fa
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
13 deletions
src/mixins/socket.js
src/store/index.js
src/store/modules/socket.js
src/views/ai/car.vue
src/mixins/socket.js
View file @
a7f3790
...
...
@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-02-25 10:30:47
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2024-03-06 1
0:02:16
* @LastEditTime: 2024-03-06 1
6:14:05
* @FilePath: \dj-scrm-wx-work-attachment-psd\src\mixins\socket.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
...
...
@@ -11,7 +11,7 @@ import { ROLE_LIST, AI_TYPE } from '@/utils/constants'
export
default
{
data
()
{
return
{
path
:
window
.
$fetchConfig
.
baseURL
,
path
:
window
.
$fetchConfig
.
baseURL
+
(
Math
.
random
()
+
''
).
slice
(
2
)
,
isShow
:
true
,
isSend
:
true
,
timer_chat
:
null
,
...
...
@@ -149,6 +149,7 @@ export default {
this
.
issue
=
''
},
close
()
{
console
.
log
(
'关闭'
)
this
.
socket
.
close
()
// 关闭 websocket
},
toBottom
()
{
...
...
src/store/index.js
View file @
a7f3790
/*
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-02-26 14:10:00
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2024-03-06 15:46:16
* @FilePath: \salesgpt-project\src\store\index.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import
Vue
from
'vue'
import
Vuex
from
'vuex'
import
getters
from
'./getters'
import
app
from
'./modules/app'
// import socket from './modules/socket'
// import createPersistedState from "vuex-persistedstate"
Vue
.
use
(
Vuex
)
const
store
=
new
Vuex
.
Store
({
modules
:
{
app
app
,
// socket
},
getters
// plugins: [createPersistedState({
...
...
src/store/modules/socket.js
0 → 100644
View file @
a7f3790
const
state
=
{
path
:
window
.
$fetchConfig
.
baseURL
,
socket
:
''
}
const
mutations
=
{}
const
actions
=
{
connect
({
state
})
{
state
.
socket
=
new
WebSocket
(
this
.
path
)
}
}
export
default
{
state
,
mutations
,
actions
}
src/views/ai/car.vue
View file @
a7f3790
...
...
@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-02-23 09:47:18
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2024-03-06 1
0:00:11
* @LastEditTime: 2024-03-06 1
7:16:14
* @FilePath: \dj-scrm-wx-work-attachment-psd\src\views\ai\index.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
...
...
@@ -53,6 +53,7 @@ export default {
return
{
isInput
:
false
,
timer
:
null
,
isStart
:
true
,
identityValue
:
''
,
messageList
:
[],
roleIndex
:
-
1
,
...
...
@@ -81,19 +82,19 @@ export default {
},
summarize
(
msg
)
{
if
(
this
.
roleIndex
>
-
1
)
{
this
.
isStart
=
false
this
.
messageList
.
push
(
msg
)
if
(
!
this
.
timer
)
this
.
timer
=
setInterval
(()
=>
{
let
i
=
this
.
messageList
.
shift
()
if
(
i
==
'<rdfast stop>'
)
{
i
=
''
this
.
roleIndex
++
}
if
(
this
.
messageList
.
length
==
0
)
{
clearInterval
(
this
.
timer
)
this
.
timer
=
null
}
this
.
$set
(
this
.
descList
,
this
.
roleIndex
,
this
.
descList
[
this
.
role
Index
]
+
i
)
this
.
$set
(
this
.
descList
,
this
.
identityIndex
,
this
.
descList
[
this
.
identity
Index
]
+
i
)
},
50
)
return
}
...
...
@@ -104,18 +105,23 @@ export default {
this
.
identityList
=
matches
.
length
?
matches
.
map
(
match
=>
match
[
1
])
:
this
.
roleMsg
.
replace
(
/
\。
/
,
''
).
split
(
'、'
)
for
(
let
i
=
0
;
i
<
this
.
identityList
.
length
;
i
++
)
{
this
.
descList
.
push
(
''
)
this
.
sendMessage
(
JSON
.
stringify
({
type
:
'roles_generate_desc'
,
question
:
`你是一名购车客户你的身份是
${
this
.
identityList
[
i
]}
,请根据你的身份从
${
CAR_TYPE
}
里面选一款车型,并描述你的用车意向,大约100字左右`
// question: `你是一名购车客户你的身份是${this.identityList[i]},请根据你的身份描述你的用车意向,大约100字左右`
})
)
}
this
.
sendIdentity
()
}
else
{
this
.
roleMsg
+=
msg
}
},
//根据角色切换生成用车意向
sendIdentity
()
{
this
.
isStart
=
true
this
.
sendMessage
(
JSON
.
stringify
({
type
:
'roles_generate_desc'
,
question
:
`你是一名购车客户你的身份是
${
this
.
identityList
[
this
.
identityIndex
]}
,请根据你的身份从
${
CAR_TYPE
}
里面选一款车型,并描述你的用车意向,大约60字左右`
// question: `你是一名购车客户你的身份是${this.identityList[i]},请根据你的身份描述你的用车意向,大约100字左右`
})
)
},
handleSelectCar
(
item
)
{
this
.
show
=
true
this
.
selectCar
=
item
...
...
@@ -124,11 +130,14 @@ export default {
this
.
sceneIndex
=
item
},
handleSelectIdentity
(
item
)
{
if
(
this
.
messageList
.
length
||
this
.
isStart
)
return
// if(this.roleIndex<=this.identityList.length) {
// return
// }
this
.
desc_d
=
''
this
.
identityIndex
=
item
if
(
this
.
descList
[
this
.
identityIndex
])
return
this
.
sendIdentity
()
},
handleSure
()
{
const
index
=
CAR_TYPE
.
findIndex
(
i
=>
this
.
descList
[
this
.
identityIndex
].
includes
(
i
))
...
...
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