将审计方案的AI分析和审计报告分开
This commit is contained in:
@@ -178,7 +178,7 @@
|
||||
<a-button
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="generateContent(index)"
|
||||
@click="generateSchema(index)"
|
||||
:loading="item.generating"
|
||||
class="section-action-button ai-generate-button"
|
||||
>
|
||||
@@ -205,7 +205,7 @@
|
||||
<!-- <a-button-->
|
||||
<!-- type="primary"-->
|
||||
<!-- size="large"-->
|
||||
<!-- @click="generateContent(index)"-->
|
||||
<!-- @click="generateSchema(index)"-->
|
||||
<!-- :loading="item.generating"-->
|
||||
<!-- class="ai-generate-btn"-->
|
||||
<!-- >-->
|
||||
@@ -231,12 +231,12 @@
|
||||
:rows="3"
|
||||
placeholder="请输入您的要求并回车..."
|
||||
class="suggestion-textarea-inner"
|
||||
@pressEnter="generateContent(index)"
|
||||
@pressEnter="generateSchema(index)"
|
||||
/>
|
||||
<a-button
|
||||
type="danger"
|
||||
size="small"
|
||||
@click="generateContent(index)"
|
||||
@click="generateSchema(index)"
|
||||
:loading="item.generating"
|
||||
class="send-button-inner"
|
||||
>
|
||||
@@ -288,7 +288,7 @@
|
||||
<a-button
|
||||
type="primary"
|
||||
size="large"
|
||||
@click.stop="generateContent(index, childIndex)"
|
||||
@click.stop="generateSchema(index, childIndex)"
|
||||
:loading="child.generating"
|
||||
class="ai-generate-btn"
|
||||
>
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user