From 087e6f45f67a899d459f7aab2db5b127f91bf193 Mon Sep 17 00:00:00 2001 From: tanggeng-RwHN2 Date: Sat, 13 Jun 2026 00:20:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86=E5=AE=A1=E8=AE=A1=E6=96=B9=E6=A1=88?= =?UTF-8?q?=E7=9A=84AI=E5=88=86=E6=9E=90=E5=92=8C=E5=AE=A1=E8=AE=A1?= =?UTF-8?q?=E6=8A=A5=E5=91=8A=E5=88=86=E5=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pwl/pwlProject/components/report.vue | 41 ++++++------------- 1 file changed, 12 insertions(+), 29 deletions(-) diff --git a/src/views/pwl/pwlProject/components/report.vue b/src/views/pwl/pwlProject/components/report.vue index 912ec3c..a279503 100644 --- a/src/views/pwl/pwlProject/components/report.vue +++ b/src/views/pwl/pwlProject/components/report.vue @@ -178,7 +178,7 @@ @@ -205,7 +205,7 @@ - + @@ -231,12 +231,12 @@ :rows="3" placeholder="请输入您的要求并回车..." class="suggestion-textarea-inner" - @pressEnter="generateContent(index)" + @pressEnter="generateSchema(index)" /> @@ -288,7 +288,7 @@ @@ -334,7 +334,6 @@ SaveOutlined } from '@ant-design/icons-vue'; import { - generateDefaultText, downloadAuditReport, queryAuditReport, saveAuditReport, @@ -781,11 +780,11 @@ if (item.children) { // 有子项的章节,为每个子项生成内容 item.children.forEach((child, childIndex) => { - promises.push(generateContent(index, childIndex)); + promises.push(generateSchema(index, childIndex)); }); } else { // 没有子项的章节 - promises.push(generateContent(index)); + promises.push(generateSchema(index)); } }); @@ -1509,7 +1508,7 @@ }; /* AI生成内容 */ - const generateContent = async (sectionIndex: number, childIndex?: number) => { + const generateSchema = async (sectionIndex: number, childIndex?: number) => { const section = navigationItems.value[sectionIndex]; // 处理主项生成(当主项没有formCommit时) @@ -1517,7 +1516,7 @@ section.generating = true; try { await Promise.all( - section.children.map((_, i) => generateContent(sectionIndex, i)) + section.children.map((_, i) => generateSchema(sectionIndex, i)) ); } finally { section.generating = false; @@ -1538,32 +1537,16 @@ formCommit = item.formCommit; } - // 新增:构建上下文数据 - const contextData = await buildExportData(); // 复用导出数据的构建逻辑 - item.generating = true; try { - // 获取章节标题 - const chapterTitle = isChild ? item.title : section.title; - - const result = await generateDefaultText({ - projectId: form.id, - formCommit: formCommit, - chapterTitle: chapterTitle - }); - // const content = result; - + // 直接调用 /api/ai/auditReport/generate 接口生成审计方案 item.content = await generateAuditReport({ kbId: form.kbId || '', kbIds: combinedKbIds.value, formCommit: formCommit, - history: result || '', - suggestion: item.suggestion || '', - // 新增:传递完整的上下文数据 - ...contextData + history: item.suggestion || '', + suggestion: item.suggestion || '' }); - // item.content = auditReportRes; - // console.log('auditReportRes', auditReportRes); } finally { item.generating = false; }