优化审计报告AI分析页面功能
This commit is contained in:
@@ -253,6 +253,7 @@ export async function generateDefaultText(params: {
|
|||||||
* AI 分析用户自定义输入
|
* AI 分析用户自定义输入
|
||||||
*/
|
*/
|
||||||
export async function analyzeUserInput(params: {
|
export async function analyzeUserInput(params: {
|
||||||
|
projectId: string;
|
||||||
formCommit: number;
|
formCommit: number;
|
||||||
userQuestion: string;
|
userQuestion: string;
|
||||||
chapterContent?: string;
|
chapterContent?: string;
|
||||||
|
|||||||
@@ -271,7 +271,7 @@ import {
|
|||||||
ReloadOutlined,
|
ReloadOutlined,
|
||||||
SaveOutlined
|
SaveOutlined
|
||||||
} from '@ant-design/icons-vue';
|
} from '@ant-design/icons-vue';
|
||||||
import {generateAuditReport, downloadAuditReport, queryAuditReport, saveAuditReport} from "@/api/ai/auditReport";
|
import {generateDefaultText, downloadAuditReport, queryAuditReport, saveAuditReport} from "@/api/ai/auditReport";
|
||||||
import {getPwlProjectLibraryByIds} from '@/api/pwl/pwlProjectLibrary';
|
import {getPwlProjectLibraryByIds} from '@/api/pwl/pwlProjectLibrary';
|
||||||
|
|
||||||
const useForm = Form.useForm;
|
const useForm = Form.useForm;
|
||||||
@@ -1373,14 +1373,13 @@ const generateContent = async (sectionIndex: number, childIndex?: number) => {
|
|||||||
|
|
||||||
item.generating = true;
|
item.generating = true;
|
||||||
try {
|
try {
|
||||||
const result = await generateAuditReport({
|
// 获取章节标题
|
||||||
kbId: form.kbId || '',
|
const chapterTitle = isChild ? item.title : section.title;
|
||||||
kbIds: combinedKbIds.value,
|
|
||||||
|
const result = await generateDefaultText({
|
||||||
|
projectId: form.id,
|
||||||
formCommit: formCommit,
|
formCommit: formCommit,
|
||||||
history: item.content || '',
|
chapterTitle: chapterTitle
|
||||||
suggestion: item.suggestion || '',
|
|
||||||
// 新增:传递完整的上下文数据
|
|
||||||
...contextData
|
|
||||||
});
|
});
|
||||||
item.content = result;
|
item.content = result;
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -523,7 +523,7 @@
|
|||||||
RobotOutlined,
|
RobotOutlined,
|
||||||
SaveOutlined
|
SaveOutlined
|
||||||
} from '@ant-design/icons-vue';
|
} from '@ant-design/icons-vue';
|
||||||
import { generateAuditReport } from '@/api/ai/auditReport';
|
import { generateDefaultText } from '@/api/ai/auditReport';
|
||||||
import { getPwlProjectLibraryByIds } from '@/api/pwl/pwlProjectLibrary';
|
import { getPwlProjectLibraryByIds } from '@/api/pwl/pwlProjectLibrary';
|
||||||
import { addAiHistory } from '@/api/ai/aiHistory';
|
import { addAiHistory } from '@/api/ai/aiHistory';
|
||||||
import * as auditContentApi from '@/api/ai/auditContent';
|
import * as auditContentApi from '@/api/ai/auditContent';
|
||||||
@@ -1267,13 +1267,15 @@
|
|||||||
|
|
||||||
section.generating = true;
|
section.generating = true;
|
||||||
try {
|
try {
|
||||||
section.content = await generateAuditReport({
|
// 获取章节标题
|
||||||
kbId: form.kbId || '',
|
const chapterTitle = childIndex !== undefined && section.children
|
||||||
kbIds: combinedKbIds.value,
|
? section.children[childIndex].title
|
||||||
|
: section.title;
|
||||||
|
|
||||||
|
section.content = await generateDefaultText({
|
||||||
|
projectId: form.id,
|
||||||
formCommit: section.formCommit || 0,
|
formCommit: section.formCommit || 0,
|
||||||
history: section.content || '',
|
chapterTitle: chapterTitle
|
||||||
suggestion: section.suggestion || '',
|
|
||||||
...contextData
|
|
||||||
});
|
});
|
||||||
} finally {
|
} finally {
|
||||||
section.generating = false;
|
section.generating = false;
|
||||||
|
|||||||
@@ -277,7 +277,7 @@ import { ref, reactive, watch, h } from 'vue';
|
|||||||
import { message } from 'ant-design-vue';
|
import { message } from 'ant-design-vue';
|
||||||
import { ReloadOutlined, RobotOutlined, DownloadOutlined, HistoryOutlined, ClearOutlined, ArrowLeftOutlined } from '@ant-design/icons-vue';
|
import { ReloadOutlined, RobotOutlined, DownloadOutlined, HistoryOutlined, ClearOutlined, ArrowLeftOutlined } from '@ant-design/icons-vue';
|
||||||
import { PwlProject } from "@/api/pwl/pwlProject/model";
|
import { PwlProject } from "@/api/pwl/pwlProject/model";
|
||||||
import { queryAuditDataByProjectId, generateAuditReportByProjectId, generateAuditReportWithEvidences, generateDefaultText, saveAuditReport, generateAuditReportWithContent } from "@/api/ai/auditReport";
|
import { queryAuditDataByProjectId, generateAuditReportByProjectId, generateAuditReportWithEvidences, generateDefaultText, saveAuditReport, generateAuditReportWithContent, analyzeUserInput } from "@/api/ai/auditReport";
|
||||||
import { getPwlProject } from "@/api/pwl/pwlProject";
|
import { getPwlProject } from "@/api/pwl/pwlProject";
|
||||||
import { getLatestHistoryByInterface } from '@/api/ai/aiHistory';
|
import { getLatestHistoryByInterface } from '@/api/ai/aiHistory';
|
||||||
import HistoryModal from './components/HistoryModal.vue';
|
import HistoryModal from './components/HistoryModal.vue';
|
||||||
@@ -617,7 +617,7 @@ const initChapterStructure = (data: any, contentMap?: Record<number, string>) =>
|
|||||||
noHistory: true // 标记为不需要历史记录
|
noHistory: true // 标记为不需要历史记录
|
||||||
},
|
},
|
||||||
{ title: `(二)${projectName.value || 'XX 公司'}概况`, content: '', formCommit: 41 },
|
{ title: `(二)${projectName.value || 'XX 公司'}概况`, content: '', formCommit: 41 },
|
||||||
{ title: `(三)${personName.value || 'XX'}同志任职及分工情况`, content: '', formCommit: 42 },
|
{ title: `(三)${personName.value || 'XX'}任职及分工情况`, content: '', formCommit: 42 },
|
||||||
{ title: '(四)实施审计的基本情况', content: '', formCommit: 43 }
|
{ title: '(四)实施审计的基本情况', content: '', formCommit: 43 }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -648,6 +648,7 @@ const initChapterStructure = (data: any, contentMap?: Record<number, string>) =>
|
|||||||
{
|
{
|
||||||
title: '五、审计建议',
|
title: '五、审计建议',
|
||||||
content: suggestion,
|
content: suggestion,
|
||||||
|
formCommit: 58, // 审计建议使用 formCommit 58
|
||||||
children: [], // 移除所有子章节
|
children: [], // 移除所有子章节
|
||||||
noSubChapters: true // 标记为没有子章节
|
noSubChapters: true // 标记为没有子章节
|
||||||
},
|
},
|
||||||
@@ -696,7 +697,7 @@ const getContentTypeText = (contentType: number): string => {
|
|||||||
const typeMap: Record<number, string> = {
|
const typeMap: Record<number, string> = {
|
||||||
1: '审计依据',
|
1: '审计依据',
|
||||||
2: `${projectName.value || 'ABC 公司'}概况`,
|
2: `${projectName.value || 'ABC 公司'}概况`,
|
||||||
3: `${personName.value || 'XX'}同志任职及分工情况`,
|
3: `${personName.value || 'XX'}任职及分工情况`,
|
||||||
4: '实施审计情况',
|
4: '实施审计情况',
|
||||||
5: '主要业绩',
|
5: '主要业绩',
|
||||||
6: '贯彻执行方针政策',
|
6: '贯彻执行方针政策',
|
||||||
@@ -857,7 +858,7 @@ const exportToWord = async () => {
|
|||||||
// 特殊处理:总体评价和审计建议
|
// 特殊处理:总体评价和审计建议
|
||||||
if (chapter.formCommit === 20) {
|
if (chapter.formCommit === 20) {
|
||||||
evaluate = chapter.content || '';
|
evaluate = chapter.content || '';
|
||||||
} else if (chapter.formCommit === 40) { // 审计建议的 formCommit 应该是 40
|
} else if (chapter.formCommit === 58) { // 审计建议的 formCommit 是 58
|
||||||
suggestion = chapter.content || '';
|
suggestion = chapter.content || '';
|
||||||
} else {
|
} else {
|
||||||
chapters.push({
|
chapters.push({
|
||||||
@@ -1127,7 +1128,7 @@ const generateFullReportHtml = (
|
|||||||
html += formatParagraphs(contentMap[41]);
|
html += formatParagraphs(contentMap[41]);
|
||||||
}
|
}
|
||||||
if (contentMap[42]) {
|
if (contentMap[42]) {
|
||||||
html += `<h3>(三)${personName}同志任职及分工情况</h3>`;
|
html += `<h3>(三)${personName}任职及分工情况</h3>`;
|
||||||
html += formatParagraphs(contentMap[42]);
|
html += formatParagraphs(contentMap[42]);
|
||||||
}
|
}
|
||||||
if (contentMap[43]) {
|
if (contentMap[43]) {
|
||||||
@@ -1215,18 +1216,17 @@ const generateFromInput = async () => {
|
|||||||
|
|
||||||
aiGenerating.value = true;
|
aiGenerating.value = true;
|
||||||
try {
|
try {
|
||||||
// 模拟AI分析(实际应调用后端接口)
|
// 获取当前章节信息
|
||||||
// 这里暂时使用模拟数据,实际应该调用AI分析接口
|
const currentChapter = outlineStructure.value[currentChapterIndex.value];
|
||||||
await new Promise(resolve => setTimeout(resolve, 1500));
|
const formCommit = currentChapter?.formCommit || getFormCommitByTitle(currentChapter?.title || '');
|
||||||
|
|
||||||
const analyzedContent = `【AI分析结果】
|
// 调用后端 AI 分析接口
|
||||||
|
const analyzedContent = await analyzeUserInput({
|
||||||
基于您输入的内容:
|
projectId: String(form.id),
|
||||||
${aiInputText.value}
|
formCommit: formCommit,
|
||||||
|
userQuestion: aiInputText.value,
|
||||||
AI分析生成的${outlineStructure.value[currentChapterIndex.value].title}内容:
|
chapterContent: currentChapter?.content || ''
|
||||||
|
});
|
||||||
这里是AI根据您的输入生成的详细内容。实际应用中,这里应该调用后端的AI分析接口,将输入内容传给AI模型,获取分析结果。`;
|
|
||||||
|
|
||||||
// 保存到历史记录
|
// 保存到历史记录
|
||||||
saveToHistory(currentChapterIndex.value, analyzedContent);
|
saveToHistory(currentChapterIndex.value, analyzedContent);
|
||||||
@@ -1256,17 +1256,16 @@ const generateFromCustomInput = async (chapter: any, chapterIndex: number) => {
|
|||||||
|
|
||||||
customGenerating.value = chapterIndex;
|
customGenerating.value = chapterIndex;
|
||||||
try {
|
try {
|
||||||
// 模拟AI分析(实际应调用后端接口)
|
// 获取 formCommit
|
||||||
await new Promise(resolve => setTimeout(resolve, 1500));
|
const formCommit = chapter.formCommit || getFormCommitByTitle(chapter.title);
|
||||||
|
|
||||||
const analyzedContent = `【AI分析结果】
|
// 调用后端 AI 分析接口
|
||||||
|
const analyzedContent = await analyzeUserInput({
|
||||||
基于您输入的内容:
|
projectId: String(form.id),
|
||||||
${chapter.customInput}
|
formCommit: formCommit,
|
||||||
|
userQuestion: chapter.customInput,
|
||||||
AI分析生成的${chapter.title}内容:
|
chapterContent: chapter.content || ''
|
||||||
|
});
|
||||||
这里是AI根据您的输入生成的详细内容。实际应用中,这里应该调用后端的AI分析接口,将输入内容传给AI模型,获取分析结果。`;
|
|
||||||
|
|
||||||
// 保存到历史记录
|
// 保存到历史记录
|
||||||
saveToHistory(chapterIndex, analyzedContent);
|
saveToHistory(chapterIndex, analyzedContent);
|
||||||
|
|||||||
Reference in New Issue
Block a user