|
@@ -110,7 +110,7 @@
|
|
|
</div>
|
|
</div>
|
|
|
<div class="tab-actions">
|
|
<div class="tab-actions">
|
|
|
<select class="form-select" v-if="activeTab=='all'" v-model="categoryId" @change="changeCategory" style="width: 250px;">
|
|
<select class="form-select" v-if="activeTab=='all'" v-model="categoryId" @change="changeCategory" style="width: 250px;">
|
|
|
- <option value="">选择分类</option>
|
|
|
|
|
|
|
+ <option value="">全部分类</option>
|
|
|
<option v-for="cat in categories" :key="cat.id" :value="cat.id">{{ cat.name }}</option>
|
|
<option v-for="cat in categories" :key="cat.id" :value="cat.id">{{ cat.name }}</option>
|
|
|
</select>
|
|
</select>
|
|
|
<div class="search-box">
|
|
<div class="search-box">
|
|
@@ -171,8 +171,7 @@
|
|
|
<div v-if="activeTab === 'all'" class="section">
|
|
<div v-if="activeTab === 'all'" class="section">
|
|
|
<div class="knowledge-list">
|
|
<div class="knowledge-list">
|
|
|
<div v-for="item in knowledgeList" :key="item.id"
|
|
<div v-for="item in knowledgeList" :key="item.id"
|
|
|
- class="knowledge-card"
|
|
|
|
|
- @click="showDocumentDetail(item)">
|
|
|
|
|
|
|
+ class="knowledge-card">
|
|
|
<!-- <div class="knowledge-icon" :style="{ background: item.iconBg }">{{ item.icon }}</div> -->
|
|
<!-- <div class="knowledge-icon" :style="{ background: item.iconBg }">{{ item.icon }}</div> -->
|
|
|
<div class="knowledge-content">
|
|
<div class="knowledge-content">
|
|
|
<div class="knowledge-header">
|
|
<div class="knowledge-header">
|
|
@@ -187,8 +186,14 @@
|
|
|
</div> -->
|
|
</div> -->
|
|
|
</div>
|
|
</div>
|
|
|
<div class="knowledge-actions" @click.stop>
|
|
<div class="knowledge-actions" @click.stop>
|
|
|
- <button class="btn btn-secondary btn-sm" @click="detailDocument(item)">
|
|
|
|
|
|
|
+ <!-- <button class="btn btn-secondary btn-sm" @click="detailDocument(item)">
|
|
|
<i class="fas fa-eye"></i>
|
|
<i class="fas fa-eye"></i>
|
|
|
|
|
+ </button> -->
|
|
|
|
|
+ <button class="btn btn-secondary btn-sm" @click="showDocumentDetail(item)">
|
|
|
|
|
+ <i class="fas fa-eye"></i>
|
|
|
|
|
+ </button>
|
|
|
|
|
+ <button class="btn btn-secondary btn-sm" @click="downloadDocuments(item)">
|
|
|
|
|
+ <i class="fas fa-download"></i>
|
|
|
</button>
|
|
</button>
|
|
|
<el-popconfirm title="确认删除?" @confirm="deleteKnowledge(item)">
|
|
<el-popconfirm title="确认删除?" @confirm="deleteKnowledge(item)">
|
|
|
<template #reference>
|
|
<template #reference>
|
|
@@ -671,7 +676,7 @@
|
|
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
|
import { ref, computed } from 'vue'
|
|
import { ref, computed } from 'vue'
|
|
|
-import { knowledgeDatasets,knowledgeDocuments,createKnowledge,createChunk,editChunk,chatMessages,baseTraining,creatTraining,baseStatistics,getAllChunks,getAllDocumnets,delDocuments,delChunk,getDocumentDetail,blocking } from '../api/knowledge'
|
|
|
|
|
|
|
+import { knowledgeDatasets,knowledgeDocuments,createKnowledge,createChunk,editChunk,chatMessages,baseTraining,creatTraining,baseStatistics,getAllChunks,getAllDocumnets,delDocuments,delChunk,getDocumentDetail,blocking,downloadDocument } from '../api/knowledge'
|
|
|
import { formatTimeAgo } from '@/utils/time'
|
|
import { formatTimeAgo } from '@/utils/time'
|
|
|
import { ElMessage } from 'element-plus'
|
|
import { ElMessage } from 'element-plus'
|
|
|
|
|
|
|
@@ -1036,6 +1041,24 @@ const showDocumentDetail = (item) => {
|
|
|
getChunkDatasets()
|
|
getChunkDatasets()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+const downloadDocuments = (item) =>{
|
|
|
|
|
+ let params = {
|
|
|
|
|
+ dataset_id:item.dataset_id,
|
|
|
|
|
+ document_id:item.id,
|
|
|
|
|
+ }
|
|
|
|
|
+ downloadDocument(params).then(res => {
|
|
|
|
|
+ if(res.success){
|
|
|
|
|
+ const url = res.result.url
|
|
|
|
|
+ // window.open(res.result.url, '_blank')
|
|
|
|
|
+ const a = document.createElement('a')
|
|
|
|
|
+ a.href = url
|
|
|
|
|
+ document.body.appendChild(a)
|
|
|
|
|
+ a.click()
|
|
|
|
|
+ document.body.removeChild(a)
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
const showKnowledgeDetail = (item) => {
|
|
const showKnowledgeDetail = (item) => {
|
|
|
selectedKnowledge.value = item
|
|
selectedKnowledge.value = item
|
|
|
showDetailModal.value = true
|
|
showDetailModal.value = true
|
|
@@ -1052,7 +1075,6 @@ const editKnowledge = (item) => {
|
|
|
showAddModal.value = true
|
|
showAddModal.value = true
|
|
|
}
|
|
}
|
|
|
const detailDocument = (item) => {
|
|
const detailDocument = (item) => {
|
|
|
- console.log(item)
|
|
|
|
|
let params = {
|
|
let params = {
|
|
|
dataset_id:item.dataset_id,
|
|
dataset_id:item.dataset_id,
|
|
|
document_id:item.id,
|
|
document_id:item.id,
|