Commit e4fd9a53 authored by mhw's avatar mhw

--

parent f56b2646
......@@ -59,7 +59,7 @@ export default {
anchorTags.forEach((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'].indexOf(tagUrl.split('.').pop().toLowerCase()) !== -1
if (isFile2 || aTag.className === 'show_detail') { // 判断知识库以及基于文件问答 的文件类型,并添加dom以及样式 || 添加特殊a标签展示详情内容
......@@ -71,7 +71,7 @@ export default {
event.preventDefault();
that.$dialog.show('文件预览', filePreview, {
area: ['100%', '100%']
}, {url: tagUrl }).then(res => {
}, { url: tagUrl }).then(res => {
}).catch(e => { });
}
......@@ -87,7 +87,7 @@ export default {
<i class="el-icon-arrow-down"></i>
</button>
`);
var buttonDom = aTag.nextElementSibling;// 下拉按钮
let describeDom = aTag.parentNode.querySelector('.describe-view') || aTag.parentNode.parentNode.querySelector('.describe-view')// 详情
this.initNetwork(describeDom, describeDom.getAttribute('data'))
......@@ -142,13 +142,13 @@ export default {
size: 12
}
},
physics: {
enabled: true,
barnesHut: {
gravitationalConstant: -2000
}
}
};
// eslint-disable-next-line no-unused-vars
......@@ -157,7 +157,7 @@ export default {
container.setAttribute('isfull', '0')
let fullDom = document.createElement('div')
fullDom.classList.add('el-icon-full-screen', 'full')
container.appendChild(fullDom)
fullDom.addEventListener('click', () => {
if (container.getAttribute('isfull') !== '0') {
......@@ -173,7 +173,7 @@ export default {
} else {
document.querySelector('.full').style.color = '#fff'
document.querySelector('.down').style.color = '#fff'
fullDom.classList.remove('el-icon-full-screen')
fullDom.classList.add('el-icon-close')
container.style.height = '100%';
......@@ -229,7 +229,7 @@ export default {
<style>
.describe-view {
overflow: hidden !important;
transition:all 0.5s ;
transition: all 0.5s;
color: #000;
font-size: 14px;
background-color: #fff;
......@@ -239,13 +239,12 @@ export default {
}
</style>
<style>
.vis-label {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.full{
.full {
width: 20px;
height: 20px;
/* background: #0092FF; */
......@@ -257,7 +256,7 @@ export default {
border-radius: 5px;
/* transition: all 0.5s; */
}
.down{
.down {
width: 20px;
height: 20px;
/* background: #0092FF; */
......
<!-- 右侧聊天界面 -->
<template>
<div class="box" ref="box">
<div class="contentBox" ref="contentBox" v-if="myHistory.length > 0">
<div v-for=" item in myHistory" :key="item.id">
<div v-for="item in myHistory" :key="item.id">
<div class="userBox">
<div class="content">
<contentView :content="item.content" />
</div>
<div class="icon">
......@@ -14,29 +12,43 @@
</div>
</div>
<div v-if="item.answer" class="gptBox">
<div class="icon">
GPT
</div>
<div class="icon">GPT</div>
<div class="content">
<contentView :content="item.answer" :ref="'contentView' + item.id" />
<contentView
:content="item.answer"
:ref="'contentView' + item.id"
/>
</div>
</div>
</div>
</div>
<div class="initBox" ref="initBox" v-else>
<div class="text">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;你好,<br>
我是人工智能语言模型<br>
我可以回答你的问题,为你提供有用信息,帮助你完成创作。<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;你好,<br />
我是人工智能语言模型<br />
我可以回答你的问题,为你提供有用信息,帮助你完成创作。<br />
</div>
</div>
<div class="inputBox">
<el-input placeholder="请输入内容" v-model="inputContent" class="input-with-select" @keyup.enter.native="submit">
<el-button slot="append" icon="el-icon-position" @click="submit"></el-button>
<el-input
placeholder="请输入内容"
v-model="inputContent"
class="input-with-select"
@keyup.enter.native="submit"
>
<el-button
slot="append"
icon="el-icon-position"
@click="submit"
></el-button>
</el-input>
<el-button icon="el-icon-delete" style="margin-left:10px" @click="clear" type="danger" plain></el-button>
<el-button
icon="el-icon-delete"
style="margin-left: 10px"
@click="clear"
type="danger"
plain
></el-button>
</div>
<div id="network"></div>
</div>
......@@ -169,13 +181,14 @@ export default {
nowChat.answer += item.answer || '\n' + item.docs
})
} else if (this.chatForm.pattern === '知识图谱问答') {
console.log(data);
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
nowChat.answer += item.answer || '\n' + item.docs.join()
// nowChat.answer += item.answer += '\n' + item.docs.join()
})
}
......@@ -216,7 +229,6 @@ export default {
var data = match2[1]
// 修改文本内容
textAfterSpecifiedString = `<div class="describe-view" data="${data}" >${textAfterSpecifiedString}</div>`
item2 = item2.replace(match2[2], textAfterSpecifiedString)
}
return item2.replace('出处', '知识溯源')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment