|
@@ -115,7 +115,7 @@
|
|
|
</select>
|
|
</select>
|
|
|
<div class="search-box">
|
|
<div class="search-box">
|
|
|
<i class="fas fa-search search-icon"></i>
|
|
<i class="fas fa-search search-icon"></i>
|
|
|
- <input type="text" v-model="searchQuery" class="search-input" @input="searchData" placeholder="搜索知识...">
|
|
|
|
|
|
|
+ <input type="text" v-model="searchQuery" class="search-input" @change="searchData" placeholder="搜索知识...">
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
@@ -190,9 +190,14 @@
|
|
|
<button class="btn btn-secondary btn-sm" @click="editKnowledge(item)">
|
|
<button class="btn btn-secondary btn-sm" @click="editKnowledge(item)">
|
|
|
<i class="fas fa-edit"></i>
|
|
<i class="fas fa-edit"></i>
|
|
|
</button>
|
|
</button>
|
|
|
- <button class="btn btn-secondary btn-sm" @click="deleteKnowledge(item)">
|
|
|
|
|
- <i class="fas fa-trash"></i>
|
|
|
|
|
- </button>
|
|
|
|
|
|
|
+ <el-popconfirm title="确认删除?" @confirm="deleteKnowledge(item)">
|
|
|
|
|
+ <template #reference>
|
|
|
|
|
+ <button class="btn btn-secondary btn-sm">
|
|
|
|
|
+ <i class="fas fa-trash"></i>
|
|
|
|
|
+ </button>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-popconfirm>
|
|
|
|
|
+
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
@@ -463,9 +468,14 @@
|
|
|
<button class="btn btn-secondary btn-sm" @click="editKnowledge(item)">
|
|
<button class="btn btn-secondary btn-sm" @click="editKnowledge(item)">
|
|
|
<i class="fas fa-edit"></i>
|
|
<i class="fas fa-edit"></i>
|
|
|
</button>
|
|
</button>
|
|
|
- <button class="btn btn-secondary btn-sm" @click="deleteKnowledge(item)">
|
|
|
|
|
- <i class="fas fa-trash"></i>
|
|
|
|
|
- </button>
|
|
|
|
|
|
|
+ <el-popconfirm title="确认删除?" @confirm="deletechunk(item)">
|
|
|
|
|
+ <template #reference>
|
|
|
|
|
+ <button class="btn btn-secondary btn-sm">
|
|
|
|
|
+ <i class="fas fa-trash"></i>
|
|
|
|
|
+ </button>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-popconfirm>
|
|
|
|
|
+
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
@@ -808,7 +818,7 @@ const categoryTotal = ref()
|
|
|
const documentsParams = ref({
|
|
const documentsParams = ref({
|
|
|
pageIndex:1,
|
|
pageIndex:1,
|
|
|
pageSize:10,
|
|
pageSize:10,
|
|
|
- dataset_id:'',
|
|
|
|
|
|
|
+ // dataset_id:'',
|
|
|
keyword:''
|
|
keyword:''
|
|
|
})
|
|
})
|
|
|
const openCategory = (category) => {
|
|
const openCategory = (category) => {
|
|
@@ -832,6 +842,21 @@ const categoryPageCurrentChange = (page) => {
|
|
|
getCategoryList(categoryId.value)
|
|
getCategoryList(categoryId.value)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// 删除知识文档
|
|
|
|
|
+const deleteKnowledge = (item) => {
|
|
|
|
|
+ let params = {
|
|
|
|
|
+ dataset_id:item.dataset_id,
|
|
|
|
|
+ document_id:item.id,
|
|
|
|
|
+ }
|
|
|
|
|
+ delDocuments(params).then(res => {
|
|
|
|
|
+ if(res.success){
|
|
|
|
|
+ showToastMessage('知识文档已删除', 'success')
|
|
|
|
|
+ getCategoryList()
|
|
|
|
|
+ }else{
|
|
|
|
|
+ ElMessage.error(res.message)
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+}
|
|
|
// 获取知识列表下的知识块
|
|
// 获取知识列表下的知识块
|
|
|
const chunkList = ref([])
|
|
const chunkList = ref([])
|
|
|
const chunksTotal = ref()
|
|
const chunksTotal = ref()
|
|
@@ -845,19 +870,34 @@ const chunkParams=ref({
|
|
|
const getChunkDatasets = () => {
|
|
const getChunkDatasets = () => {
|
|
|
chunkLoading.value = true
|
|
chunkLoading.value = true
|
|
|
getAllChunks(chunkParams.value).then(res => {
|
|
getAllChunks(chunkParams.value).then(res => {
|
|
|
- chunkLoading.value = false
|
|
|
|
|
- chunkList.value = res.result.data
|
|
|
|
|
- res.result.data.forEach(el => {
|
|
|
|
|
- el.timeip = formatTimeAgo(el.updated_at)
|
|
|
|
|
- });
|
|
|
|
|
- chunksTotal.value = res.result.total
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ chunkLoading.value = false
|
|
|
|
|
+ chunkList.value = res.result.data
|
|
|
|
|
+ res.result.data.forEach(el => {
|
|
|
|
|
+ el.timeip = formatTimeAgo(el.updated_at)
|
|
|
|
|
+ });
|
|
|
|
|
+ chunksTotal.value = res.result.total
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
const chunkCurrentChange = (page) => {
|
|
const chunkCurrentChange = (page) => {
|
|
|
chunkParams.value.pageIndex = page
|
|
chunkParams.value.pageIndex = page
|
|
|
getChunkDatasets()
|
|
getChunkDatasets()
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+// 删除知识块
|
|
|
|
|
+const deletechunk = (item) => {
|
|
|
|
|
+ let params = {
|
|
|
|
|
+ dataset_id:item.dataset_id,
|
|
|
|
|
+ document_id:item.document_id,
|
|
|
|
|
+ segment_id:item.id,
|
|
|
|
|
+ }
|
|
|
|
|
+ delChunk(params).then(res => {
|
|
|
|
|
+ if(res.success){
|
|
|
|
|
+ showToastMessage('知识块已删除', 'success')
|
|
|
|
|
+ getChunkDatasets()
|
|
|
|
|
+ }else{
|
|
|
|
|
+ ElMessage.error(res.message)
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
const qaRecords = ref([])
|
|
const qaRecords = ref([])
|
|
|
const qaRecordsTotal = ref()
|
|
const qaRecordsTotal = ref()
|
|
@@ -868,8 +908,8 @@ const chatParams=ref({
|
|
|
keyword:'',
|
|
keyword:'',
|
|
|
})
|
|
})
|
|
|
const getChatMessages = () => {
|
|
const getChatMessages = () => {
|
|
|
- chatParams.value.keyword = searchQuery.value
|
|
|
|
|
- chatMessages(chatParams.value).then(res => {
|
|
|
|
|
|
|
+ chatParams.value.keyword = searchQuery.value
|
|
|
|
|
+ chatMessages(chatParams.value).then(res => {
|
|
|
tabs.value[2].count = qaRecordsTotal.value = res.result.total
|
|
tabs.value[2].count = qaRecordsTotal.value = res.result.total
|
|
|
res.result.records.forEach(el => {
|
|
res.result.records.forEach(el => {
|
|
|
el.time = formatTimeAgo(el.createdAt)
|
|
el.time = formatTimeAgo(el.createdAt)
|
|
@@ -967,7 +1007,6 @@ const delFile = (targetItem) => {
|
|
|
const documentName = ref()
|
|
const documentName = ref()
|
|
|
const showDocumentDetail = (item) => {
|
|
const showDocumentDetail = (item) => {
|
|
|
selectedDocument.value = item
|
|
selectedDocument.value = item
|
|
|
- console.log(item)
|
|
|
|
|
showChunksModal.value = true
|
|
showChunksModal.value = true
|
|
|
documentName.value = item.name
|
|
documentName.value = item.name
|
|
|
chunkParams.value.dataset_id = item.dataset_id
|
|
chunkParams.value.dataset_id = item.dataset_id
|
|
@@ -1017,9 +1056,7 @@ const editKnowledge = (item) => {
|
|
|
showToastMessage('正在编辑知识...', 'success')
|
|
showToastMessage('正在编辑知识...', 'success')
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-const deleteKnowledge = (item) => {
|
|
|
|
|
- showToastMessage('知识已删除', 'success')
|
|
|
|
|
-}
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
const addKnowledgeDocument = ()=> {
|
|
const addKnowledgeDocument = ()=> {
|
|
|
newKnowledge.value.name = ''
|
|
newKnowledge.value.name = ''
|