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