|
@@ -77,6 +77,9 @@
|
|
<el-dropdown-item command="analysis">
|
|
<el-dropdown-item command="analysis">
|
|
<i data-feather="play" class="icons"></i> 批量解析
|
|
<i data-feather="play" class="icons"></i> 批量解析
|
|
</el-dropdown-item>
|
|
</el-dropdown-item>
|
|
|
|
+ <el-dropdown-item command="generateQa">
|
|
|
|
+ <i data-feather="message-square" class="icons"></i> 生成问答对
|
|
|
|
+ </el-dropdown-item>
|
|
<el-dropdown-item command="modifyFolder">
|
|
<el-dropdown-item command="modifyFolder">
|
|
<i data-feather="folder" class="icons"></i> 批量修改目录
|
|
<i data-feather="folder" class="icons"></i> 批量修改目录
|
|
</el-dropdown-item>
|
|
</el-dropdown-item>
|
|
@@ -144,6 +147,7 @@
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
<el-table-column prop="type" label="文件类型" align="center" />
|
|
<el-table-column prop="type" label="文件类型" align="center" />
|
|
|
|
+ <el-table-column prop="qa_count" label="问答对数" align="center"></el-table-column>
|
|
<el-table-column prop="chunk_num" label="分块数" align="center" />
|
|
<el-table-column prop="chunk_num" label="分块数" align="center" />
|
|
<el-table-column
|
|
<el-table-column
|
|
prop="create_time"
|
|
prop="create_time"
|
|
@@ -574,6 +578,7 @@ import {
|
|
analysisPro,
|
|
analysisPro,
|
|
resultTask,
|
|
resultTask,
|
|
endClear,
|
|
endClear,
|
|
|
|
+ generateQa,
|
|
} from "@/api/knowledge";
|
|
} from "@/api/knowledge";
|
|
import { exportQaToExcel,queryDocumentContent } from "@/api/document";
|
|
import { exportQaToExcel,queryDocumentContent } from "@/api/document";
|
|
import { validateExportParams, logJSON, checkJSONSize } from "@/utils/data-validator";
|
|
import { validateExportParams, logJSON, checkJSONSize } from "@/utils/data-validator";
|
|
@@ -840,6 +845,9 @@ export default {
|
|
case "analysis":
|
|
case "analysis":
|
|
this.batchAnalysis();
|
|
this.batchAnalysis();
|
|
break;
|
|
break;
|
|
|
|
+ case "generateQa":
|
|
|
|
+ this.batchGenerateQa();
|
|
|
|
+ break;
|
|
case "modifyFolder":
|
|
case "modifyFolder":
|
|
this.batchModifyFolder();
|
|
this.batchModifyFolder();
|
|
break;
|
|
break;
|
|
@@ -848,6 +856,44 @@ export default {
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+
|
|
|
|
+ // 批量生成问答对
|
|
|
|
+ batchGenerateQa() {
|
|
|
|
+ if (this.selectedRows.length === 0) {
|
|
|
|
+ this.$message.warning("请选择要生成问答对的文件");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ const loading = this.$loading({
|
|
|
|
+ lock: true,
|
|
|
|
+ text: '正在生成问答对,请稍候...',
|
|
|
|
+ spinner: 'el-icon-loading',
|
|
|
|
+ background: 'rgba(0, 0, 0, 0.7)'
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ const selectedIds = this.selectedRows.map(row => row.id);
|
|
|
|
+ generateQa({
|
|
|
|
+ document_ids: JSON.stringify(selectedIds)
|
|
|
|
+ }).then((res) => {
|
|
|
|
+ console.log('生成问答对响应:', res);
|
|
|
|
+ if (res.status === 200) {
|
|
|
|
+ this.$message.success('问答对生成任务已提交');
|
|
|
|
+ // 更新选中文档的状态
|
|
|
|
+ this.selectedRows.forEach(row => {
|
|
|
|
+ this.$set(row, 'run', 6); // 设置状态为"待生成问答对"
|
|
|
|
+ this.startAnalysisStatusChecker(row); // 开始检查状态
|
|
|
|
+ });
|
|
|
|
+ this.clearSelection(); // 清除选择
|
|
|
|
+ } else {
|
|
|
|
+ this.$message.error(res.data?.message || '生成问答对失败');
|
|
|
|
+ }
|
|
|
|
+ }).catch(error => {
|
|
|
|
+ console.error('生成问答对时出错:', error);
|
|
|
|
+ this.$message.error('生成问答对失败,请稍后重试');
|
|
|
|
+ }).finally(() => {
|
|
|
|
+ loading.close();
|
|
|
|
+ });
|
|
|
|
+ },
|
|
getProgressStatus(progress) {
|
|
getProgressStatus(progress) {
|
|
// el-progress 只接受 'success'/'exception'/'warning' 这几个值
|
|
// el-progress 只接受 'success'/'exception'/'warning' 这几个值
|
|
if (progress >= 100) {
|
|
if (progress >= 100) {
|