|
@@ -395,6 +395,21 @@
|
|
|
<relateFiles ref="relateFiles"></relateFiles>
|
|
|
<checkDialog ref="checkDialog"></checkDialog>
|
|
|
<WebCrawlDialog :visible.sync="webUrlDialogVisible" :input-url.sync="webInputUrl" @confirm="handleWebUrlConfirm"/>
|
|
|
+ <el-dialog
|
|
|
+ :title="lang.prompt2"
|
|
|
+ :visible.sync="promptDialog"
|
|
|
+ class="fileDialogBlock"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ :before-close="handleClose"
|
|
|
+ >
|
|
|
+ <span class="promptBox" v-loading="promptLoading">
|
|
|
+ <!-- <el-input v-model="prompt" :placeholder="lang.promptPlaceholder" class="promptInput"></el-input> -->
|
|
|
+ <el-input type="textarea" v-model="prompt" :placeholder="lang.promptPlaceholder" rows="5"></el-input>
|
|
|
+ <div class="btnbox">
|
|
|
+ <el-button type="primary" @click="handleExtract">{{ lang.confirm }}</el-button>
|
|
|
+ </div>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -513,7 +528,10 @@ export default {
|
|
|
fileType: 1,
|
|
|
webUrlDialogVisible: false,
|
|
|
webInputUrl: '',
|
|
|
-
|
|
|
+ row: {},
|
|
|
+ promptDialog: false,
|
|
|
+ promptLoading: false,
|
|
|
+ prompt: "",
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
@@ -989,53 +1007,106 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
|
|
|
+ // extractFile(row) {
|
|
|
+ // if (row.ingestionStatus != "success")
|
|
|
+ // return this.$message.info(this.lang.fileUploadFail);
|
|
|
+
|
|
|
+ // let params = {
|
|
|
+ // documentid: row.documentid,
|
|
|
+ // };
|
|
|
+ // // 获取切片
|
|
|
+ // try {
|
|
|
+ // const res = this.ajax
|
|
|
+ // .post(this.$store.state.fileApi + "extractFile2", [params])
|
|
|
+ // .then((res) => {
|
|
|
+ // console.log(res, row);
|
|
|
+ // const message = res.data.result && res.data.result.message;
|
|
|
+ // // const status = message === 'Document entities and relationships extracted successfully.' ? 'success' : 'failed';
|
|
|
+ // // const msg = message === 'Document entities and relationships extracted successfully.' ? '提取成功' : '提取失败';
|
|
|
+ // // this.$message({
|
|
|
+ // // message: msg,
|
|
|
+ // // type: status == 'success' ? status : 'error'
|
|
|
+ // // })
|
|
|
+ // // this.fileArray.forEach(e => {
|
|
|
+ // // if (e.documentid === row.documentid) {
|
|
|
+ // // e.extractionStatus = status;
|
|
|
+ // // }
|
|
|
+ // // });
|
|
|
+ // setTimeout(() => {
|
|
|
+ // this.getData();
|
|
|
+ // }, 1000);
|
|
|
+ // })
|
|
|
+ // .catch((err) => {
|
|
|
+ // this.$message.error(this.lang.extrFailed);
|
|
|
+ // this.fileArray.forEach((e) => {
|
|
|
+ // if (e.documentid === row.documentid) {
|
|
|
+ // e.extractionStatus = "failed";
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // console.error(err);
|
|
|
+ // });
|
|
|
+
|
|
|
+ // console.log(res.data);
|
|
|
+ // this.$message.success(this.lang.extractingFile);
|
|
|
+ // } catch (err) {
|
|
|
+ // console.error(err);
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ checkType(type) {
|
|
|
+ this.fileType = type;
|
|
|
+ },
|
|
|
extractFile(row) {
|
|
|
- if (row.ingestionStatus != "success")
|
|
|
- return this.$message.info(this.lang.fileUploadFail);
|
|
|
-
|
|
|
+ if (row.ingestionStatus != "success") return this.$message.info(this.lang.fileUploadFail)
|
|
|
+ this.row = row
|
|
|
+ this.promptDialog = true;
|
|
|
+ },
|
|
|
+ handleExtract() {
|
|
|
+ this.promptLoading = true
|
|
|
let params = {
|
|
|
- documentid: row.documentid,
|
|
|
+ documentid: this.row.documentid,
|
|
|
+ prompt: this.prompt
|
|
|
};
|
|
|
// 获取切片
|
|
|
try {
|
|
|
- const res = this.ajax
|
|
|
- .post(this.$store.state.fileApi + "extractFile2", [params])
|
|
|
- .then((res) => {
|
|
|
- console.log(res, row);
|
|
|
- const message = res.data.result && res.data.result.message;
|
|
|
- // const status = message === 'Document entities and relationships extracted successfully.' ? 'success' : 'failed';
|
|
|
- // const msg = message === 'Document entities and relationships extracted successfully.' ? '提取成功' : '提取失败';
|
|
|
- // this.$message({
|
|
|
- // message: msg,
|
|
|
- // type: status == 'success' ? status : 'error'
|
|
|
- // })
|
|
|
- // this.fileArray.forEach(e => {
|
|
|
- // if (e.documentid === row.documentid) {
|
|
|
- // e.extractionStatus = status;
|
|
|
- // }
|
|
|
- // });
|
|
|
- setTimeout(() => {
|
|
|
- this.getData();
|
|
|
- }, 1000);
|
|
|
- })
|
|
|
- .catch((err) => {
|
|
|
- this.$message.error(this.lang.extrFailed);
|
|
|
- this.fileArray.forEach((e) => {
|
|
|
- if (e.documentid === row.documentid) {
|
|
|
- e.extractionStatus = "failed";
|
|
|
- }
|
|
|
- });
|
|
|
- console.error(err);
|
|
|
+ const res = this.ajax.post(this.$store.state.fileApi + "extractFile2", [
|
|
|
+ params
|
|
|
+ ]).then(res => {
|
|
|
+ console.log(res, this.row);
|
|
|
+ const message = res.data.result && res.data.result.message;
|
|
|
+ // const status = message === 'Document entities and relationships extracted successfully.' ? 'success' : 'failed';
|
|
|
+ // const msg = message === 'Document entities and relationships extracted successfully.' ? '提取成功' : '提取失败';
|
|
|
+ // this.$message({
|
|
|
+ // message: msg,
|
|
|
+ // type: status == 'success' ? status : 'error'
|
|
|
+ // })
|
|
|
+ // this.fileArray.forEach(e => {
|
|
|
+ // if (e.documentid === row.documentid) {
|
|
|
+ // e.extractionStatus = status;
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ setTimeout(() => {
|
|
|
+ this.promptLoading = false
|
|
|
+ this.promptDialog = false
|
|
|
+ this.getData();
|
|
|
+ }, 1000)
|
|
|
+ }).catch(err => {
|
|
|
+ this.promptLoading = false
|
|
|
+ this.$message.error(this.lang.extrFailed)
|
|
|
+ this.fileArray.forEach(e => {
|
|
|
+ if (e.documentid === this.row.documentid) {
|
|
|
+ e.extractionStatus = 'failed';
|
|
|
+ }
|
|
|
});
|
|
|
-
|
|
|
+ console.error(err);
|
|
|
+ });
|
|
|
console.log(res.data);
|
|
|
this.$message.success(this.lang.extractingFile);
|
|
|
+ this.getData();
|
|
|
} catch (err) {
|
|
|
+ this.promptLoading = false
|
|
|
+
|
|
|
console.error(err);
|
|
|
- }
|
|
|
- },
|
|
|
- checkType(type) {
|
|
|
- this.fileType = type;
|
|
|
+ }
|
|
|
},
|
|
|
},
|
|
|
mounted() {
|