将审计方案的AI分析和审计报告分开
This commit is contained in:
@@ -178,7 +178,7 @@
|
|||||||
<a-button
|
<a-button
|
||||||
type="primary"
|
type="primary"
|
||||||
size="small"
|
size="small"
|
||||||
@click="generateContent(index)"
|
@click="generateSchema(index)"
|
||||||
:loading="item.generating"
|
:loading="item.generating"
|
||||||
class="section-action-button ai-generate-button"
|
class="section-action-button ai-generate-button"
|
||||||
>
|
>
|
||||||
@@ -205,7 +205,7 @@
|
|||||||
<!-- <a-button-->
|
<!-- <a-button-->
|
||||||
<!-- type="primary"-->
|
<!-- type="primary"-->
|
||||||
<!-- size="large"-->
|
<!-- size="large"-->
|
||||||
<!-- @click="generateContent(index)"-->
|
<!-- @click="generateSchema(index)"-->
|
||||||
<!-- :loading="item.generating"-->
|
<!-- :loading="item.generating"-->
|
||||||
<!-- class="ai-generate-btn"-->
|
<!-- class="ai-generate-btn"-->
|
||||||
<!-- >-->
|
<!-- >-->
|
||||||
@@ -231,12 +231,12 @@
|
|||||||
:rows="3"
|
:rows="3"
|
||||||
placeholder="请输入您的要求并回车..."
|
placeholder="请输入您的要求并回车..."
|
||||||
class="suggestion-textarea-inner"
|
class="suggestion-textarea-inner"
|
||||||
@pressEnter="generateContent(index)"
|
@pressEnter="generateSchema(index)"
|
||||||
/>
|
/>
|
||||||
<a-button
|
<a-button
|
||||||
type="danger"
|
type="danger"
|
||||||
size="small"
|
size="small"
|
||||||
@click="generateContent(index)"
|
@click="generateSchema(index)"
|
||||||
:loading="item.generating"
|
:loading="item.generating"
|
||||||
class="send-button-inner"
|
class="send-button-inner"
|
||||||
>
|
>
|
||||||
@@ -288,7 +288,7 @@
|
|||||||
<a-button
|
<a-button
|
||||||
type="primary"
|
type="primary"
|
||||||
size="large"
|
size="large"
|
||||||
@click.stop="generateContent(index, childIndex)"
|
@click.stop="generateSchema(index, childIndex)"
|
||||||
:loading="child.generating"
|
:loading="child.generating"
|
||||||
class="ai-generate-btn"
|
class="ai-generate-btn"
|
||||||
>
|
>
|
||||||
@@ -334,7 +334,6 @@
|
|||||||
SaveOutlined
|
SaveOutlined
|
||||||
} from '@ant-design/icons-vue';
|
} from '@ant-design/icons-vue';
|
||||||
import {
|
import {
|
||||||
generateDefaultText,
|
|
||||||
downloadAuditReport,
|
downloadAuditReport,
|
||||||
queryAuditReport,
|
queryAuditReport,
|
||||||
saveAuditReport,
|
saveAuditReport,
|
||||||
@@ -781,11 +780,11 @@
|
|||||||
if (item.children) {
|
if (item.children) {
|
||||||
// 有子项的章节,为每个子项生成内容
|
// 有子项的章节,为每个子项生成内容
|
||||||
item.children.forEach((child, childIndex) => {
|
item.children.forEach((child, childIndex) => {
|
||||||
promises.push(generateContent(index, childIndex));
|
promises.push(generateSchema(index, childIndex));
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// 没有子项的章节
|
// 没有子项的章节
|
||||||
promises.push(generateContent(index));
|
promises.push(generateSchema(index));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1509,7 +1508,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* AI生成内容 */
|
/* AI生成内容 */
|
||||||
const generateContent = async (sectionIndex: number, childIndex?: number) => {
|
const generateSchema = async (sectionIndex: number, childIndex?: number) => {
|
||||||
const section = navigationItems.value[sectionIndex];
|
const section = navigationItems.value[sectionIndex];
|
||||||
|
|
||||||
// 处理主项生成(当主项没有formCommit时)
|
// 处理主项生成(当主项没有formCommit时)
|
||||||
@@ -1517,7 +1516,7 @@
|
|||||||
section.generating = true;
|
section.generating = true;
|
||||||
try {
|
try {
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
section.children.map((_, i) => generateContent(sectionIndex, i))
|
section.children.map((_, i) => generateSchema(sectionIndex, i))
|
||||||
);
|
);
|
||||||
} finally {
|
} finally {
|
||||||
section.generating = false;
|
section.generating = false;
|
||||||
@@ -1538,32 +1537,16 @@
|
|||||||
formCommit = item.formCommit;
|
formCommit = item.formCommit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 新增:构建上下文数据
|
|
||||||
const contextData = await buildExportData(); // 复用导出数据的构建逻辑
|
|
||||||
|
|
||||||
item.generating = true;
|
item.generating = true;
|
||||||
try {
|
try {
|
||||||
// 获取章节标题
|
// 直接调用 /api/ai/auditReport/generate 接口生成审计方案
|
||||||
const chapterTitle = isChild ? item.title : section.title;
|
|
||||||
|
|
||||||
const result = await generateDefaultText({
|
|
||||||
projectId: form.id,
|
|
||||||
formCommit: formCommit,
|
|
||||||
chapterTitle: chapterTitle
|
|
||||||
});
|
|
||||||
// const content = result;
|
|
||||||
|
|
||||||
item.content = await generateAuditReport({
|
item.content = await generateAuditReport({
|
||||||
kbId: form.kbId || '',
|
kbId: form.kbId || '',
|
||||||
kbIds: combinedKbIds.value,
|
kbIds: combinedKbIds.value,
|
||||||
formCommit: formCommit,
|
formCommit: formCommit,
|
||||||
history: result || '',
|
history: item.suggestion || '',
|
||||||
suggestion: item.suggestion || '',
|
suggestion: item.suggestion || ''
|
||||||
// 新增:传递完整的上下文数据
|
|
||||||
...contextData
|
|
||||||
});
|
});
|
||||||
// item.content = auditReportRes;
|
|
||||||
// console.log('auditReportRes', auditReportRes);
|
|
||||||
} finally {
|
} finally {
|
||||||
item.generating = false;
|
item.generating = false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user