Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
lmp_web
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
yujian
lmp_web
Commits
b62a22ec
Commit
b62a22ec
authored
Apr 15, 2024
by
mhw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
版本跟新
parent
b7558ad7
Changes
12
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
293 additions
and
196 deletions
+293
-196
DatasetData.js
src/api/GptController/DatasetData.js
+3
-3
development.js
src/core/config/development.js
+2
-2
getStreaming.js
src/utils/getStreaming.js
+2
-3
websocket.js
src/utils/websocket.js
+4
-0
label.vue
.../dataServices/myDataSet/versionsTableBox/dialog/label.vue
+12
-4
particulars.vue
...ervices/myDataSet/versionsTableBox/dialog/particulars.vue
+35
-6
particulars.vue
.../onlineAnnotation/versionsTableBox/dialog/particulars.vue
+2
-1
previewCommand.vue
...Tuning/sft/particulars/taskList/dialog/previewCommand.vue
+26
-23
taskOperate.vue
...ineTuning/sft/particulars/taskList/dialog/taskOperate.vue
+70
-53
editOrAdd.vue
...ning/modelManagement/modelEvaluation/dialog/editOrAdd.vue
+1
-0
index.vue
.../modelService/testOnline/components/contentView/index.vue
+93
-61
index.vue
...ing/modelService/testOnline/components/rightBox/index.vue
+43
-40
No files found.
src/api/GptController/DatasetData.js
View file @
b62a22ec
...
...
@@ -6,11 +6,12 @@ export default class DatasetData {
static
view
(
sender
,
params
,
axiosOption
,
httpOption
)
{
return
sender
.
doUrl
(
'/admin/app/datasetData/view'
,
'get'
,
params
,
axiosOption
,
httpOption
);
}
static
update
(
sender
,
params
,
axiosOption
,
httpOption
)
{
return
sender
.
doUrl
(
'/admin/app/datasetData/update'
,
'post'
,
params
,
axiosOption
,
httpOption
);
}
static
add
(
sender
,
params
,
axiosOption
,
httpOption
)
{
return
sender
.
doUrl
(
'/admin/app/datasetData/add'
,
'post'
,
params
,
axiosOption
,
httpOption
);
}
static
delete
(
sender
,
params
,
axiosOption
,
httpOption
)
{
return
sender
.
doUrl
(
'/admin/app/datasetData/delete'
,
'post'
,
params
,
axiosOption
,
httpOption
);
}
...
...
@@ -20,5 +21,4 @@ export default class DatasetData {
static
summaryCount
(
sender
,
params
,
axiosOption
,
httpOption
)
{
return
sender
.
doUrl
(
'/admin/app/datasetData/summaryCount'
,
'get'
,
params
,
axiosOption
,
httpOption
);
}
DatasetData
}
src/core/config/development.js
View file @
b62a22ec
module
.
exports
=
{
// baseUrl: 'http://218.76.0.69:8082/',
baseUrl
:
'http://192.168.0.34:8082/'
,
//
baseUrl: 'http://192.168.0.34:8082/',
// baseUrl: 'http://192.168.0.36:8082/',
// baseUrl: 'http://192.168.0.168
:8082/',
baseUrl
:
'http://192.168.0.36
:8082/'
,
wsUrl
:
'ws://218.76.0.69:7860/'
,
projectName
:
'灵境大模型平台'
}
src/utils/getStreaming.js
View file @
b62a22ec
...
...
@@ -101,9 +101,8 @@ class GetStreaming {
}
catch
{
console
.
error
(
'onmessage error'
);
}
that
.
onmessage
(
data
)
console
.
info
(
data
);
if
(
data
.
status
===
0
)
{
that
.
onmessage
(
JSON
.
stringify
(
data
))
if
(
data
?.
status
===
0
)
{
that
.
success
()
}
},
...
...
src/utils/websocket.js
View file @
b62a22ec
...
...
@@ -15,6 +15,7 @@ class SocketService {
}
// 初始化weosocket
async
initWebSocket
()
{
console
.
log
(
1111123123123123
);
this
.
ws
=
await
new
WebSocket
(
this
.
url
);
this
.
ws
.
onopen
=
await
this
.
websocketonopen
.
bind
(
this
);
this
.
ws
.
onerror
=
await
this
.
websocketonerror
.
bind
(
this
);
...
...
@@ -63,6 +64,9 @@ class SocketService {
websocketclose
(
e
)
{
// 关闭
// Message('connection closed (' + e.code + ')')
}
close
()
{
this
.
ws
.
close
();
}
}
export
{
SocketService
}
src/views/gptTraining/dataServices/myDataSet/versionsTableBox/dialog/label.vue
View file @
b62a22ec
...
...
@@ -31,10 +31,10 @@ import { DatasetData } from '@/api/gptController.js'
export
default
{
data
()
{
return
{
form
:
JSON
.
parse
(
JSON
.
stringify
(
this
.
row
)
)
form
:
this
.
deepCopy
(
this
.
row
)
}
},
props
:
[
'row'
,
'columnList'
,
'refresh'
,
'isEdit'
],
props
:
[
'row'
,
'columnList'
,
'refresh'
,
'isEdit'
,
'versionId'
],
components
:
{},
computed
:
{},
...
...
@@ -42,6 +42,13 @@ export default {
mounted
()
{},
methods
:
{
deepCopy
(
data
)
{
try
{
return
JSON
.
parse
(
JSON
.
stringify
(
data
))
}
catch
(
error
)
{
return
{
data
:
{
instruction
:
''
,
output
:
''
}
}
}
},
onCancel
(
isSuccess
)
{
if
(
this
.
observer
!=
null
)
{
this
.
observer
.
cancel
(
isSuccess
)
...
...
@@ -50,9 +57,10 @@ export default {
onSubmit
()
{
let
params
=
{}
params
.
datasetMongoDto
=
this
.
form
DatasetData
.
update
(
this
,
params
)
params
.
datasetMongoDto
.
versionId
=
this
.
versionId
DatasetData
[
this
.
versionId
?
'add'
:
'update'
](
this
,
params
)
.
then
((
res
)
=>
{
this
.
$message
.
success
(
'编辑成功'
)
this
.
$message
.
success
(
this
.
versionId
?
'添加成功'
:
'编辑成功'
)
this
.
onCancel
(
true
)
})
.
catch
((
e
)
=>
{})
...
...
src/views/gptTraining/dataServices/myDataSet/versionsTableBox/dialog/particulars.vue
View file @
b62a22ec
...
...
@@ -2,17 +2,20 @@
<
template
>
<div
class=
"tableBox"
>
<div
class=
"topBox"
>
<el-breadcrumb
separator=
"|"
>
<el-breadcrumb-item
:class=
"nowPage==0?'isactive':''"
@
click
.
native=
"breadcrumbClick(0)"
>
全部(
{{
allNum
}}
)
</el-breadcrumb-item>
<el-breadcrumb-item
:class=
"nowPage==1?'isactive':''"
@
click
.
native=
"breadcrumbClick(1)"
>
无标注信息(
{{
unmarkedNum
}}
)
</el-breadcrumb-item>
<el-breadcrumb-item
:class=
"nowPage==2?'isactive':''"
@
click
.
native=
"breadcrumbClick(2)"
>
有标注信息(
{{
markedNum
}}
)
</el-breadcrumb-item>
</el-breadcrumb>
<el-button
:size=
"defaultFormItemSize"
@
click=
"add()"
>
新增
</el-button>
</div>
<vxe-table
border
show-header-overflow
show-overflow
:row-config=
"
{ isHover: true }" :data="myDataSetPage.tableData.impl.dataList" min-height="96">
<!--
<vxe-column
field=
"index"
title=
"序号"
></vxe-column>
-->
<!--
<vxe-column
:field=
"'data.'+item"
:title=
"item"
v-for=
"item in columnList"
:key=
"item"
></vxe-column>
-->
<vxe-column
field=
"data.instruction"
title=
"问题"
></vxe-column>
<vxe-column
field=
"data.output"
title=
"回答"
></vxe-column>
<vxe-column
field=
"operation"
title=
"操作"
width=
"150px"
>
<template
slot-scope=
"scope"
>
<el-button
type=
"text"
:size=
"defaultFormItemSize"
@
click=
"check(scope.row)"
>
查看
</el-button>
...
...
@@ -150,9 +153,28 @@ export default {
)
.
then
((
res
)
=>
{
this
.
refresh
()
this
.
summaryCount
()
})
.
catch
((
e
)
=>
{})
},
add
()
{
// 添加
this
.
$dialog
.
show
(
'添加'
,
label
,
{
area
:
[
'70%'
,
'50%'
]
},
{
versionId
:
this
.
versionItem
.
versionId
,
refresh
:
this
.
refresh
,
isEdit
:
true
}
)
.
then
((
res
)
=>
{
this
.
refresh
()
this
.
summaryCount
()
})
.
catch
((
e
)
=>
{})
},
del
(
item
)
{
this
.
$confirm
(
'是否确认删除'
,
'提示'
,
{
confirmButtonText
:
'确定'
,
...
...
@@ -164,6 +186,7 @@ export default {
.
then
((
res
)
=>
{
this
.
$message
.
success
(
'删除成功'
)
this
.
refresh
()
this
.
summaryCount
()
})
.
catch
((
e
)
=>
{
console
.
log
(
e
)
...
...
@@ -282,4 +305,10 @@ export default {
/
deep
/
.isactive
.el-breadcrumb__inner
{
color
:
#0092ff
!
important
;
}
.topBox
{
display
:
flex
;
height
:
auto
;
align-items
:
center
;
justify-content
:
space-between
;
}
</
style
>
src/views/gptTraining/dataServices/onlineAnnotation/versionsTableBox/dialog/particulars.vue
View file @
b62a22ec
<!--详情 -->
<
template
>
<div
class=
"tableBox"
>
<el-breadcrumb
separator=
"|"
>
<el-breadcrumb-item
:class=
"nowPage==0?'isactive':''"
@
click
.
native=
"breadcrumbClick(0)"
>
全部(
{{
allNum
}}
)
</el-breadcrumb-item>
...
...
@@ -150,6 +149,7 @@ export default {
)
.
then
((
res
)
=>
{
this
.
refresh
()
this
.
summaryCount
()
})
.
catch
((
e
)
=>
{})
},
...
...
@@ -164,6 +164,7 @@ export default {
.
then
((
res
)
=>
{
this
.
$message
.
success
(
'删除成功'
)
this
.
refresh
()
this
.
summaryCount
()
})
.
catch
((
e
)
=>
{
console
.
log
(
e
)
...
...
src/views/gptTraining/modelFineTuning/sft/particulars/taskList/dialog/previewCommand.vue
View file @
b62a22ec
...
...
@@ -11,11 +11,11 @@
</
template
>
<
script
>
import
Clipboard
from
'clipboard'
;
import
{
TuningRun
}
from
'@/api/gptController.js'
;
import
Clipboard
from
'clipboard'
import
{
TuningRun
}
from
'@/api/gptController.js'
// import { getSessionHash } from '@/utils/index';
export
default
{
data
()
{
data
()
{
return
{
clipboard
:
null
,
result
:
''
,
...
...
@@ -26,59 +26,62 @@ export default {
fn_index
:
18
,
session_hash
:
this
.
item
.
runId
}
}
;
}
},
components
:
{},
computed
:
{
resultAdjust
()
{
resultAdjust
()
{
return
this
.
result
.
replace
(
/
\n
/g
,
'<br/>'
).
replace
(
'```bash'
,
''
)
}
},
props
:
[
'item'
],
mounted
()
{
mounted
()
{
this
.
SocketService
.
initWebSocket
()
this
.
clipboard
=
new
Clipboard
(
this
.
$refs
.
copy
.
$el
)
;
this
.
clipboard
=
new
Clipboard
(
this
.
$refs
.
copy
.
$el
)
},
methods
:
{
successful
()
{
// 连接成功
successful
()
{
// 连接成功
this
.
send
(
`{"fn_index":
${
this
.
wsData
.
fn_index
}
,"session_hash":"
${
this
.
wsData
.
session_hash
}
"}`
)
this
.
getPreviewCommand
()
},
getPreviewCommand
()
{
// 获取参数
TuningRun
.
getPreviewCommand
(
this
,
{
runId
:
this
.
item
.
runId
}).
then
((
res
)
=>
{
getPreviewCommand
()
{
// 获取参数
TuningRun
.
getPreviewCommand
(
this
,
{
runId
:
this
.
item
.
runId
}).
then
((
res
)
=>
{
this
.
wsData
.
data
=
res
.
data
this
.
send
(
JSON
.
stringify
(
this
.
wsData
))
})
},
send
(
data
)
{
// 发送参数
send
(
data
)
{
// 发送参数
this
.
SocketService
.
websocketsend
(
data
)
},
websocketonmessage
(
e
)
{
// 返回接收参数
websocketonmessage
(
e
)
{
// 返回接收参数
console
.
log
(
e
)
if
(
JSON
.
parse
(
e
.
data
).
msg
===
'process_generating'
)
{
this
.
result
=
JSON
.
parse
(
e
.
data
).
output
.
data
[
0
]
}
},
copy
()
{
copy
()
{
try
{
this
.
clipboard
.
on
(
'success'
,
e
=>
{
this
.
$message
.
success
(
'接入信息复制成功!'
)
;
this
.
clipboard
.
on
(
'success'
,
(
e
)
=>
{
this
.
$message
.
success
(
'接入信息复制成功!'
)
this
.
clipboard
=
null
})
;
this
.
clipboard
.
on
(
'error'
,
e
=>
{
this
.
$message
.
error
(
'浏览器不支持复制'
)
;
})
this
.
clipboard
.
on
(
'error'
,
(
e
)
=>
{
this
.
$message
.
error
(
'浏览器不支持复制'
)
this
.
clipboard
=
null
})
;
})
}
catch
(
e
)
{
console
.
log
(
e
)
;
console
.
log
(
e
)
}
}
}
}
</
script
>
<
style
scoped
>
</
style
>
src/views/gptTraining/modelFineTuning/sft/particulars/taskList/dialog/taskOperate.vue
View file @
b62a22ec
<!-- 任务列表操作 -->
<
template
>
<div
class=
"tableBox"
>
<el-button
:size=
"defaultFormItemSize"
type=
"primary"
@
click=
"preview"
>
预览命令
</el-button>
<el-button
:size=
"defaultFormItemSize"
type=
"primary"
@
click=
"start"
:disabled=
"istraining"
>
开始训练
</el-button>
<el-button
:size=
"defaultFormItemSize"
type=
"primary"
@
click=
"start"
:disabled=
"istraining"
>
开始训练
</el-button>
<el-button
:size=
"defaultFormItemSize"
type=
"primary"
@
click=
"pause"
:disabled=
"!istraining"
>
中断训练
</el-button>
<el-tabs
v-model=
"activeName"
:size=
"defaultFormItemSize"
>
<el-tab-pane
label=
"运行详情"
name=
"particulars"
><particulars
:item=
"item"
/></el-tab-pane>
<el-tab-pane
label=
"评估报告"
name=
"assessmentReport"
><assessmentReport
ref=
"assessmentReport"
:item=
"item"
:result=
"result"
:img=
"img"
/></el-tab-pane>
<el-tab-pane
label=
"训练日志"
name=
"trainingLog"
><trainingLog
:item=
"item"
:result=
"result"
/></el-tab-pane>
<el-tab-pane
label=
"运行详情"
name=
"particulars"
>
<particulars
:item=
"item"
/>
</el-tab-pane>
<el-tab-pane
label=
"评估报告"
name=
"assessmentReport"
>
<assessmentReport
ref=
"assessmentReport"
:item=
"item"
:result=
"result"
:img=
"img"
/>
</el-tab-pane>
<el-tab-pane
label=
"训练日志"
name=
"trainingLog"
>
<trainingLog
:item=
"item"
:result=
"result"
/>
</el-tab-pane>
</el-tabs>
</div>
</
template
>
<
script
>
import
particulars
from
'./operate/particulars'
;
import
assessmentReport
from
'./operate/assessmentReport'
;
import
trainingLog
from
'./operate/trainingLog'
;
import
particulars
from
'./operate/particulars'
import
assessmentReport
from
'./operate/assessmentReport'
import
trainingLog
from
'./operate/trainingLog'
// eslint-disable-next-line no-unused-vars
import
previewCommand
from
'./previewCommand'
;
import
previewCommand
from
'./previewCommand'
// import { getSessionHash } from '@/utils/index';
import
{
TuningRun
,
PyApi
}
from
'@/api/gptController.js'
;
import
{
TuningRun
,
PyApi
}
from
'@/api/gptController.js'
export
default
{
data
()
{
data
()
{
return
{
istraining
:
false
,
// 是否在训练中
img
:
''
,
...
...
@@ -36,34 +41,32 @@ export default {
},
activeName
:
this
.
page
,
timeImg
:
null
}
;
}
},
props
:
[
'page'
,
'item'
],
components
:
{
particulars
,
assessmentReport
,
trainingLog
},
components
:
{
particulars
,
assessmentReport
,
trainingLog
},
computed
:
{},
mounted
()
{
},
mounted
()
{},
methods
:
{
PyApi
(
index
,
data
=
[])
{
PyApi
(
index
,
data
=
[])
{
let
param
=
{
data
:
data
,
event_data
:
null
,
fn_index
:
index
,
session_hash
:
this
.
item
.
runId
}
return
PyApi
.
predict
(
this
,
param
).
then
((
res
)
=>
{
if
(
index
===
22
)
{
// 图片
if
(
index
===
22
)
{
// 图片
// console.log(res);
this
.
img
=
JSON
.
parse
(
res
.
data
).
data
[
0
]?.
plot
;
this
.
img
=
JSON
.
parse
(
res
.
data
).
data
[
0
]?.
plot
console
.
log
(
this
.
img
);
}
else
if
(
index
===
20
)
{
// 暂停
console
.
log
(
this
.
img
)
}
else
if
(
index
===
20
)
{
// 暂停
this
.
$message
({
message
:
'已暂停'
,
type
:
'success'
...
...
@@ -72,62 +75,76 @@ export default {
// this.result = {output: {data: []}}
})
},
preview
()
{
this
.
$dialog
.
show
(
'预览命令'
,
previewCommand
,
{
preview
()
{
this
.
$dialog
.
show
(
'预览命令'
,
previewCommand
,
{
area
:
[
'50%'
,
'70%'
]
},
{
item
:
this
.
item
}).
then
(
res
=>
{
this
.
refresh
();
}).
catch
(
e
=>
{
});
},
start
()
{
{
item
:
this
.
item
}
)
.
then
((
res
)
=>
{
this
.
refresh
()
})
.
catch
((
e
)
=>
{})
},
start
()
{
this
.
SocketService
.
initWebSocket
()
},
async
pause
()
{
async
pause
()
{
await
this
.
PyApi
(
20
)
TuningRun
.
updateById
(
this
,
{
tuningRunDto
:
{
runId
:
this
.
item
.
runId
,
runStatus
:
-
2
}}).
then
(
res
=>
{
console
.
log
(
res
);
}).
catch
(
e
=>
{
});
TuningRun
.
updateById
(
this
,
{
tuningRunDto
:
{
runId
:
this
.
item
.
runId
,
runStatus
:
-
2
}
})
.
then
((
res
)
=>
{
console
.
log
(
res
)
})
.
catch
((
e
)
=>
{})
},
getPreviewCommand
()
{
// 获取参数
TuningRun
.
getPreviewCommand
(
this
,
{
runId
:
this
.
item
.
runId
}).
then
((
res
)
=>
{
getPreviewCommand
()
{
// 获取参数
TuningRun
.
getPreviewCommand
(
this
,
{
runId
:
this
.
item
.
runId
}).
then
((
res
)
=>
{
this
.
wsData
.
data
=
res
.
data
this
.
send
(
JSON
.
stringify
(
this
.
wsData
))
})
},
successful
()
{
// 连接成功
successful
()
{
// 连接成功
this
.
send
(
`{"fn_index":
${
this
.
wsData
.
fn_index
}
,"session_hash":"
${
this
.
wsData
.
session_hash
}
"}`
)
// this.getPreviewCommand()
},
send
(
data
)
{
// 发送参数
send
(
data
)
{
// 发送参数
this
.
SocketService
.
websocketsend
(
data
)
},
websocketonmessage
(
e
)
{
// 返回接收参数
if
(
JSON
.
parse
(
e
.
data
).
msg
===
'process_generating'
)
{
// 开始训练
websocketonmessage
(
e
)
{
// 返回接收参数
if
(
JSON
.
parse
(
e
.
data
).
msg
===
'process_generating'
)
{
// 开始训练
this
.
istraining
=
true
this
.
result
=
JSON
.
parse
(
e
.
data
)
if
(
!
this
.
timeImg
)
{
// this.startGetImg()
}
}
else
if
(
JSON
.
parse
(
e
.
data
).
msg
===
'process_completed'
)
{
// 训练结束
}
else
if
(
JSON
.
parse
(
e
.
data
).
msg
===
'process_completed'
)
{
// 训练结束
this
.
$refs
.
assessmentReport
.
completed
()
clearInterval
(
this
.
timeImg
)
this
.
timeImg
=
null
this
.
istraining
=
false
this
.
$refs
.
assessmentReport
.
init
(
true
)
}
else
if
(
JSON
.
parse
(
e
.
data
).
msg
===
'send_data'
)
{
// 可以发送训练数据
}
else
if
(
JSON
.
parse
(
e
.
data
).
msg
===
'send_data'
)
{
// 可以发送训练数据
this
.
getPreviewCommand
()
}
},
startGetImg
()
{
startGetImg
()
{
this
.
timeImg
=
setInterval
(()
=>
{
this
.
PyApi
(
22
,
[
this
.
wsData
.
data
[
1
],
this
.
wsData
.
data
[
3
],
this
.
wsData
.
data
[
37
]])
},
10000
)
;
},
10000
)
}
}
}
</
script
>
<
style
scoped
>
</
style
>
src/views/gptTraining/modelManagement/modelEvaluation/dialog/editOrAdd.vue
View file @
b62a22ec
...
...
@@ -64,6 +64,7 @@ export default {
this
.
getDataList
()
if
(
this
.
isCopy
)
{
this
.
form
.
modelEstimateDto
=
{
...
this
.
item
}
this
.
form
.
modelEstimateDto
.
datasetVersionIds
=
this
.
item
.
datasetVersionIds
}
else
if
(
this
.
modelVersionId
)
{
this
.
form
.
modelEstimateDto
.
modelVersionId
=
this
.
modelVersionId
}
...
...
src/views/gptTraining/modelService/testOnline/components/contentView/index.vue
View file @
b62a22ec
This diff is collapsed.
Click to expand it.
src/views/gptTraining/modelService/testOnline/components/rightBox/index.vue
View file @
b62a22ec
...
...
@@ -146,48 +146,51 @@ export default {
},
onmessage
(
data
)
{
console
.
log
(
data
)
// let nowChat = this.myHistory[this.myHistory.length - 1]
// if (this.chatForm.pattern === 0) {
// // 通用智能问答
// // data = data.replace(/^data:\s+|\s+$/g, '')
// nowChat.excludeReferenceAnswer += data
// nowChat.answer += data
// } else if (this.chatForm.pattern === 1) {
// // 专业知识库问答
// // console.log(data)
// let temporary = JSON.parse(`[${data}]`.replace(/}{/g, '},{'))
// temporary.forEach((item) => {
// this.modifyContent(item) // 修改返回内容
// nowChat.excludeReferenceAnswer += item.answer || '' // 排除回答中的引用内容
// nowChat.answer += item.answer || '\n' + item.docs
// })
// } else if (this.chatForm.pattern === 2) {
// // 搜索引擎问答
// } else if (this.chatForm.pattern === 3) {
// // 基于文件问答
// let temporary = JSON.parse(`[${data}]`.replace(/}{/g, '},{'))
// temporary.forEach((item) => {
// this.modifyContent(item) // 修改返回内容
// nowChat.excludeReferenceAnswer += item.answer || '' // 排除回答中的引用内容
// nowChat.answer += item.answer || '\n' + item.docs
// })
// } else if (this.chatForm.pattern === 4) {
// let temporary = JSON.parse(`[${data}]`.replace(/}{/g, '},{'))
let
nowChat
=
this
.
myHistory
[
this
.
myHistory
.
length
-
1
]
if
(
this
.
chatForm
.
pattern
===
0
)
{
let
temporary
=
JSON
.
parse
(
`[
${
data
}
]`
.
replace
(
/}{/g
,
'},{'
))
// 通用智能问答
// data = data.replace(/^data:\s+|\s+$/g, '')
// nowChat.excludeReferenceAnswer += data.answer
// nowChat.answer += data.answer
temporary
.
forEach
((
item
)
=>
{
this
.
modifyContent
(
item
)
// 修改返回内容
nowChat
.
excludeReferenceAnswer
+=
item
.
answer
||
''
// 排除回答中的引用内容
nowChat
.
answer
+=
item
.
answer
||
'
\
n'
+
(
item
.
docs
||
''
)
})
}
else
if
(
this
.
chatForm
.
pattern
===
1
)
{
// 专业知识库问答
// console.log(data)
let
temporary
=
JSON
.
parse
(
`[
${
data
}
]`
.
replace
(
/}{/g
,
'},{'
))
temporary
.
forEach
((
item
)
=>
{
this
.
modifyContent
(
item
)
// 修改返回内容
nowChat
.
excludeReferenceAnswer
+=
item
.
answer
||
''
// 排除回答中的引用内容
nowChat
.
answer
+=
item
.
answer
||
'
\
n'
+
(
item
.
docs
||
''
)
})
}
else
if
(
this
.
chatForm
.
pattern
===
2
)
{
// 搜索引擎问答
}
else
if
(
this
.
chatForm
.
pattern
===
3
)
{
// 基于文件问答
let
temporary
=
JSON
.
parse
(
`[
${
data
}
]`
.
replace
(
/}{/g
,
'},{'
))
// temporary.forEach((item) => {
// console.log(item)
// this.modifyContent(item) // 修改返回内容
// nowChat.excludeReferenceAnswer += item.answer || '' // 排除回答中的引用内容
// nowChat.answer += item.answer || '\n' + item.docs.join()
// // nowChat.answer += item.answer += '\n' + item.docs.join()
// })
// }
temporary
.
forEach
((
item
)
=>
{
this
.
modifyContent
(
item
)
// 修改返回内容
nowChat
.
excludeReferenceAnswer
+=
item
.
answer
||
''
// 排除回答中的引用内容
nowChat
.
answer
+=
item
.
answer
||
'
\
n'
+
(
item
.
docs
||
''
)
})
}
else
if
(
this
.
chatForm
.
pattern
===
4
)
{
let
temporary
=
JSON
.
parse
(
`[
${
data
}
]`
.
replace
(
/}{/g
,
'},{'
))
temporary
.
forEach
((
item
)
=>
{
this
.
modifyContent
(
item
)
// 修改返回内容
nowChat
.
excludeReferenceAnswer
+=
item
.
answer
||
''
// 排除回答中的引用内容
nowChat
.
answer
+=
item
.
answer
||
'
\
n'
+
(
item
.
docs
.
join
()
||
''
)
// nowChat.answer += item.answer += '\n' + item.docs.join()
})
}
//
this.$nextTick(() => {
//
this.$refs.contentBox.scrollTo(0, this.$refs.contentBox.scrollHeight)
//
})
this
.
$nextTick
(()
=>
{
this
.
$refs
.
contentBox
.
scrollTo
(
0
,
this
.
$refs
.
contentBox
.
scrollHeight
)
})
},
modifyContent
(
item
)
{
// 修改返回内容
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment