chore(config): 添加项目配置文件和隐私协议
- 新增 .editorconfig 文件统一代码风格配置 - 新增 .env 环境变量配置文件 - 添加开发和生产环境的环境变量配置 - 配置 ESLint 忽略规则文件 - 设置代码检查配置文件 .eslintrc.js - 添加 Git 忽略文件规则 - 创建 Prettier 格式化忽略规则 - 添加隐私政策和服务协议HTML文件 - 实现访问密钥编辑组件基础结构
This commit is contained in:
70
src/api/ai/auditReport/index.ts
Normal file
70
src/api/ai/auditReport/index.ts
Normal file
@@ -0,0 +1,70 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult } from '@/api';
|
||||
import type { AuditReport } from './model';
|
||||
import { MODULES_API_URL } from '@/config/setting';
|
||||
|
||||
/**
|
||||
* 生成审计报告-单一模块
|
||||
*/
|
||||
export async function generateAuditReport(data: AuditReport) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/ai/auditReport/generate',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成并下载审计报告
|
||||
*/
|
||||
export async function downloadAuditReport(req: AuditReport) {
|
||||
const res = await request.post(
|
||||
MODULES_API_URL + '/ai/auditReport/download',
|
||||
req,
|
||||
{
|
||||
responseType: 'blob' // 处理二进制流响应
|
||||
}
|
||||
);
|
||||
|
||||
if (res.status === 200) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error('文件下载失败'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成审计核查报告 - 重构版
|
||||
*/
|
||||
export async function generateAuditReport2(
|
||||
file: File,
|
||||
kbId?: string,
|
||||
libraryIds?: string,
|
||||
analysisLibrary?: string,
|
||||
projectLibrary?: string
|
||||
) {
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
|
||||
if (kbId) formData.append('kbId', kbId);
|
||||
if (libraryIds) formData.append('libraryIds', libraryIds);
|
||||
if (analysisLibrary) formData.append('analysisLibrary', analysisLibrary);
|
||||
if (projectLibrary) formData.append('projectLibrary', projectLibrary);
|
||||
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/ai/auditReport2/generate',
|
||||
formData,
|
||||
{
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data'
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
Reference in New Issue
Block a user