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
4e1ec2bb
Commit
4e1ec2bb
authored
Dec 25, 2023
by
mhw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
预览修改
parent
2f94e54a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
11 deletions
+46
-11
index.vue
.../modelService/testOnline/components/contentView/index.vue
+40
-8
index.vue
...ing/modelService/testOnline/components/rightBox/index.vue
+6
-3
No files found.
src/views/gptTraining/modelService/testOnline/components/contentView/index.vue
View file @
4e1ec2bb
...
...
@@ -55,10 +55,14 @@ export default {
// 遍历并输出链接的 href 属性
anchorTags
.
forEach
((
aTag
)
=>
{
let
tagUrl
=
aTag
.
getAttribute
(
'href'
)
console
.
log
(
aTag
);
let
tagUrl
=
aTag
.
getAttribute
(
'href'
)
||
''
let
isFile
=
[
'pdf'
,
'jpg'
,
'gif'
,
'jpeg'
,
'png'
,
'docx'
,
'doc'
,
'xlsx'
,
'xls'
,
'mp4'
,
'webm'
,
'ogg'
,
'ogv'
,
'txt'
].
indexOf
(
tagUrl
.
split
(
'.'
).
pop
().
toLowerCase
())
!==
-
1
let
isFile2
=
[
'html'
,
'md'
,
'json'
,
'jsonl'
,
'csv'
,
'pdf'
,
'png'
,
'jpg'
,
'jpeg'
,
'bmp'
,
'eml'
,
'msg'
,
'epub'
,
'xlsx'
,
'xlsd'
,
'ipynb'
,
'odt'
,
'py'
,
'rst'
,
'rtf'
,
'srt'
,
'toml'
,
'tsv'
,
'docx'
,
'doc'
,
'xml'
,
'ppt'
,
'pptx'
,
'txt'
,
'htm'
]
if
(
isFile2
||
aTag
.
id
===
'show_detail'
)
{
// 判断知识库以及文件对话 的文件类型,并添加dom以及样式
console
.
log
(
isFile
);
let
isFile2
=
[
'html'
,
'md'
,
'json'
,
'jsonl'
,
'csv'
,
'pdf'
,
'png'
,
'jpg'
,
'jpeg'
,
'bmp'
,
'eml'
,
'msg'
,
'epub'
,
'xlsx'
,
'xlsd'
,
'ipynb'
,
'odt'
,
'py'
,
'rst'
,
'rtf'
,
'srt'
,
'toml'
,
'tsv'
,
'docx'
,
'doc'
,
'xml'
,
'ppt'
,
'pptx'
,
'txt'
,
'htm'
].
indexOf
(
tagUrl
.
split
(
'.'
).
pop
().
toLowerCase
())
!==
-
1
if
(
isFile2
||
aTag
.
id
===
'show_detail'
)
{
// 判断知识库以及文件对话 的文件类型,并添加dom以及样式 || 添加特殊a标签展示详情内容
console
.
log
(
aTag
);
this
.
setDescribeStyle
(
aTag
)
}
aTag
.
addEventListener
(
'click'
,
function
(
event
)
{
...
...
@@ -75,19 +79,47 @@ export default {
});
},
setDescribeStyle
(
aTag
)
{
let
describeDom
=
aTag
.
parentNode
.
nextElementSibling
// let describeDom = aTag
.nextElementSibling
// 在当前元素前插入新的 HTML 内容
describeDom
.
insertAdjacentHTML
(
'beforebegin
'
,
`
aTag
.
insertAdjacentHTML
(
'afterend
'
,
`
<button style="margin-bottom:10px" type="button" class="el-button el-button--primary el-button--mini is-round">
<span style="margin-right:5px">详情</span>
<i class="el-icon-arrow-down"></i>
</button>
`
);
// 获取当前元素的父元素
var
parentElement
=
aTag
.
parentNode
;
describeDom
.
classList
.
add
(
'describe-view'
)
// 获取当前元素在父元素中的索引
// var currentIndex = Array.from(parentElement.children).indexOf(aTag);
// 获取当前元素的同级后面的所有内容(包括文本节点)
var
siblingNodesAfter
=
[];
var
twoSibling
=
aTag
.
nextElementSibling
;
var
nextSibling
=
twoSibling
.
nextSibling
;
while
(
nextSibling
)
{
if
(
nextSibling
.
nodeType
===
1
||
nextSibling
.
nodeType
===
3
)
{
// 添加元素节点和文本节点
siblingNodesAfter
.
push
(
nextSibling
);
}
nextSibling
=
nextSibling
.
nextSibling
;
}
// 创建外层的
<
div
>
元素
var
wrapperDiv
=
document
.
createElement
(
'div'
);
wrapperDiv
.
classList
.
add
(
'describe-view'
)
// 将获取的同级元素放入外层的
<
div
>
siblingNodesAfter
.
forEach
(
function
(
node
)
{
wrapperDiv
.
appendChild
(
node
);
});
parentElement
.
appendChild
(
wrapperDiv
);
// describeDom.classList.add('describe-view')
let
describeDom
=
aTag
.
nextElementSibling
.
nextElementSibling
let
height
=
describeDom
.
scrollHeight
describeDom
.
setAttribute
(
'style'
,
'height:0px;'
)
describeDom
.
previousElement
Sibling
.
addEventListener
(
'click'
,
function
(
event
)
{
two
Sibling
.
addEventListener
(
'click'
,
function
(
event
)
{
if
(
height
>
0
&&
(
describeDom
.
style
.
height
!==
'0px'
&&
describeDom
.
style
.
height
!==
''
))
{
describeDom
.
setAttribute
(
'style'
,
'height:0px;'
)
}
else
{
...
...
@@ -111,7 +143,7 @@ export default {
</
style
>
<
style
>
.describe-view
{
overflow
:
hidden
;
overflow
:
hidden
!important
;
transition
:
0.5s
all
;
color
:
#000
;
font-size
:
14px
;
...
...
src/views/gptTraining/modelService/testOnline/components/rightBox/index.vue
View file @
4e1ec2bb
...
...
@@ -157,7 +157,7 @@ export default {
}
else
if
(
this
.
chatForm
.
pattern
===
'文件对话'
)
{
let
temporary
=
JSON
.
parse
(
`[
${
data
}
]`
.
replace
(
/}{/g
,
'},{'
))
temporary
.
forEach
((
item
)
=>
{
this
.
modifyContent
(
item
)
// 修改返回内容
nowChat
.
excludeReferenceAnswer
+=
item
.
answer
||
''
// 排除回答中的引用内容
...
...
@@ -165,8 +165,9 @@ export default {
})
}
else
if
(
this
.
chatForm
.
pattern
===
'知识图谱问答'
)
{
let
temporary
=
JSON
.
parse
(
`[
${
data
}
]`
.
replace
(
/}{/g
,
'},{'
))
console
.
log
(
temporary
);
temporary
.
forEach
((
item
)
=>
{
this
.
modifyContent
(
item
)
// 修改返回内容
nowChat
.
excludeReferenceAnswer
+=
item
.
answer
||
''
// 排除回答中的引用内容
nowChat
.
answer
+=
item
.
answer
||
'
\
n'
+
item
.
docs
})
...
...
@@ -179,8 +180,10 @@ export default {
modifyContent
(
item
)
{
// 修改返回内容
if
(
item
.
docs
)
{
item
.
docs
=
item
.
docs
.
map
((
item2
)
=>
{
let
tagUrl
=
item2
?.
match
(
/
\]\((
.*
?)\)
/g
)[
0
].
slice
(
2
,
-
1
)
let
tagUrl
=
((
item2
?.
match
(
/
\]\((
.*
?)\)
/g
)
||
[])[
0
]
||
''
).
slice
(
2
,
-
1
)
console
.
log
(
tagUrl
);
let
url
=
''
item2
=
item2
.
replace
(
/
\n
/g
,
'<br>'
)
if
(
tagUrl
.
indexOf
(
'https'
)
!==
-
1
)
{
url
=
tagUrl
.
replace
(
/^https:
\/\/[^/]
+
\/
/
,
`https://
${
window
.
location
.
hostname
}
:
${
window
.
location
.
port
}
/`
);
item2
=
item2
.
replace
(
/
\]\((
.*
?)\)
/g
,
`](
${
url
}
)`
)
...
...
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