feat(knowledge): 添加一键上传和处理功能

- 新增 directEmbedding API 用于一键上传
- 实现一键处理功能,包括文件上传和直接嵌入处理
- 优化消息提示样式,移除冗余代码
- 添加新的 API 路径和代理配置
This commit is contained in:
陈昱达
2025-04-27 11:02:23 +08:00
parent 86b1deffff
commit 6e54354f9a
6 changed files with 63 additions and 52 deletions

View File

@@ -206,6 +206,15 @@ export function uploadFileByCustom(data) {
} }
}) })
} }
/*一键上传*/
export function directEmbedding(data) {
return request({
url: getUrl(`/datasetDocumentEx/direct/embedding`),
method: 'post',
data
})
}
//知识库文件上传-通用 //知识库文件上传-通用
export function uploadFileByTemplate(data) { export function uploadFileByTemplate(data) {
return request({ return request({
@@ -226,6 +235,7 @@ export function datasetQuerySegments(data) {
params: data params: data
}) })
} }
// 知识文档详情查询包含json的题词和拆分规则 // 知识文档详情查询包含json的题词和拆分规则
export function datasetDocumentEx(data) { export function datasetDocumentEx(data) {
return request({ return request({
@@ -234,6 +244,7 @@ export function datasetDocumentEx(data) {
params: data params: data
}) })
} }
// 任务轨迹查看详情 // 任务轨迹查看详情
export function getTaskDetail(params) { export function getTaskDetail(params) {
return request({ return request({

View File

@@ -20,65 +20,35 @@
.el-message--success { .el-message--success {
background: $--message-success-light; background: $--message-success-light;
border-radius: 12px; border-radius: 12px;
border: 1px solid $--message-success-border; //border: 1px solid $--message-success-border;
& .el-message__content {
font-family: PingFangSC;
font-size: 14px;
color: #000000;
line-height: 20px;
text-align: left;
font-style: normal;
}
} }
.el-message--error { .el-message--error {
width: 255px;
height: 46px;
border-radius: 12px;
border: 1px solid #e44655;
background: $--message-error-light; background: $--message-error-light;
border-radius: 12px; border-radius: 12px;
border: 1px solid $--message-error-border; border: 1px solid $--message-error-border;
& .el-message__content {
font-family: PingFangSC;
font-size: 14px;
color: #000000;
line-height: 20px;
text-align: left;
font-style: normal;
}
} }
.el-message--warning { .el-message--warning {
width: 255px;
height: 46px;
border-radius: 12px;
border: 1px solid #e44655;
background: $--message-warning-light; background: $--message-warning-light;
border-radius: 12px; border-radius: 12px;
border: 1px solid $--message-warning-border; border: 1px solid $--message-warning-border;
& .el-message__content {
font-family: PingFangSC;
font-size: 14px;
color: #000000;
line-height: 20px;
text-align: left;
font-style: normal;
}
} }
.el-message--info { .el-message--info {
width: 255px;
height: 46px;
border-radius: 12px;
border: 1px solid #e44655;
background: $--message-info-light; background: $--message-info-light;
border-radius: 12px; border-radius: 12px;
border: 1px solid $--message-info-border; border: 1px solid $--message-info-border;
}
.el-message--info,
.el-message--warning,
.el-message--error,
.el-message--success {
& .el-message__content { & .el-message__content {
font-family: PingFangSC; font-family: PingFangSC;
font-size: 14px; font-size: 14px;
color: #000000; //color: $--color-primary-desc-text;
line-height: 20px; line-height: 20px;
text-align: left; text-align: left;
font-style: normal; font-style: normal;

View File

@@ -1,8 +1,9 @@
let envInfo = process.env let envInfo = process.env
// let [admin, jifen] = [envInfo.VUE_APP_ADMIN, 'http://192.168.2.62:7196/'] // let [admin, jifen] = [envInfo.VUE_APP_ADMIN, 'http://192.168.2.62:7196/']
let [admin, jifen] = ['/api', 'http://192.168.2.62:7196/'] let [admin, jifen, zixi] = ['/api', 'http://192.168.2.62:7196/', '/jifen']
export default { export default {
admin, admin,
jifen jifen,
zixi
} }

View File

@@ -148,7 +148,7 @@ export default {
input.click() input.click()
}, },
uploadFiled() { uploadFiled(back) {
if (!this.filed) { if (!this.filed) {
this.$message({ this.$message({
type: 'error', type: 'error',
@@ -165,7 +165,11 @@ export default {
formData.append('beOcr', this.form.beOcr) formData.append('beOcr', this.form.beOcr)
} }
api(formData).then(response => { api(formData).then(response => {
if(response){
this.documentId = response.content.content this.documentId = response.content.content
if(back){
back(this.documentId)
} else {
// 向上导入documentId // 向上导入documentId
this.$emit('getDocumentId', this.documentId) this.$emit('getDocumentId', this.documentId)
// 文件内容 // 文件内容
@@ -175,6 +179,10 @@ export default {
if (this.form.beMinerU) { if (this.form.beMinerU) {
this.$emit('beMinerU', true) this.$emit('beMinerU', true)
} }
}
}
}) })
}, },
handleDragOver() { handleDragOver() {

View File

@@ -73,7 +73,7 @@
type="primary" type="primary"
size="medium" size="medium"
class="line-button" class="line-button"
@click="fetchApi" @click="oneClickAction"
> >
<img :src="magic" alt="" style="width: 12px;" /> <img :src="magic" alt="" style="width: 12px;" />
一键处理 一键处理
@@ -103,6 +103,7 @@ import StepPreprocessing from './components/preprocessing.vue'
import SplitConfig from '@/views/knowledge/detail/components/split/Index.vue' import SplitConfig from '@/views/knowledge/detail/components/split/Index.vue'
import Words from '@/views/knowledge/detail/components/words/Index.vue' import Words from '@/views/knowledge/detail/components/words/Index.vue'
import magic from '@/assets/images/konwledge/magic.png' import magic from '@/assets/images/konwledge/magic.png'
import { directEmbedding } from '@/api/generatedApi'
// import StepC // import StepC
export default { export default {
name: 'create', name: 'create',
@@ -142,7 +143,20 @@ export default {
this.saveMarkDown() this.saveMarkDown()
} }
}, },
fetchApi() {}, oneClickAction() {
this.$refs.stepPreProcessing.uploadFiled(e => {
if (e) {
directEmbedding({ documentId: e }).then(res => {
if (res) {
this.$message.success('处理成功')
this.$router.go(-1)
}
})
} else {
this.$message.error('上传失败,请重试')
}
})
},
getDocumentId(id) { getDocumentId(id) {
this.documentId = id this.documentId = id
}, },

View File

@@ -59,6 +59,13 @@ module.exports = {
pathRewrite: { pathRewrite: {
'^/jifen': '' '^/jifen': ''
} }
},
'/zixi': {
target: 'http://192.168.8.165:7196/',
changeOrigin: true,
pathRewrite: {
'^/jifen': ''
}
} }
} }
}, },