Files
Situation-Awareness-Platfor…/src/api/jyh/index.ts

501 lines
10 KiB
TypeScript
Raw Normal View History

2025-03-18 17:13:54 +08:00
import { reqCatchV2, type catchRt } from '@/utils/catch';
import request from '@/utils/request';
2025-03-19 10:44:39 +08:00
import * as types from '@/api/repo/types';
2025-03-26 20:09:09 +08:00
import axios from 'axios';
// 详情-获取版本信息
2025-03-19 10:08:49 +08:00
export function releaseInfo(params: { softwareId: string }): Promise<any> {
const { softwareId } = params;
return request({
url: `/api/v1/repo/release/info?softwareId=${softwareId}`,
method: 'get'
});
}
2025-03-18 20:20:37 +08:00
// 详情-搜索结果列表
export function releasePage(data): Promise<any> {
return request({
url: `/api/v1/repo/release/page`,
method: 'post',
data
});
}
2025-03-18 19:51:01 +08:00
// 获取邀请列表
2025-03-18 17:13:54 +08:00
export function getInviteListData(): catchRt<any> {
2025-03-19 10:08:49 +08:00
return reqCatchV2(() =>
request(
{
url: '/api/v1/group/member/invite/list',
method: 'get'
},
{
customError: true
}
)
);
2025-03-18 17:13:54 +08:00
}
2025-03-18 19:51:01 +08:00
// 处理邀请
2025-03-18 17:13:54 +08:00
export function acceptInvite(params): catchRt<any> {
2025-03-19 10:08:49 +08:00
return reqCatchV2(() =>
request(
{
url: '/api/v1/group/member/invite/accept',
method: 'post',
data: params
},
{
customError: true
}
)
);
2025-03-18 17:13:54 +08:00
}
2025-03-18 19:51:01 +08:00
// 发送订阅
export function subscribeSoftware(params): catchRt<any> {
2025-03-19 10:08:49 +08:00
return reqCatchV2(() =>
request(
{
url: '/api/v1/alert/subscribe',
method: 'post',
data: params
},
{
customError: true
}
)
);
2025-03-18 19:51:01 +08:00
}
2025-03-18 20:20:37 +08:00
// 获取高级筛选语言列表
export function searchLanguageList() {
return request({
url: `/api/v1/repo/lan/list`,
method: 'get'
});
}
// 获取首页公告列表
export function getHomeNoticeList() {
return request({
url: '/api/v1/home/notice/list',
method: 'get',
params: {}
});
}
// 获取依赖关系列表
export function getDepencyList(softwareId: string) {
return request({
2025-03-18 22:01:02 +08:00
url: '/api/v1/repo/dependency/info',
method: 'POST',
2025-03-19 10:08:49 +08:00
data: {
2025-03-18 22:01:02 +08:00
softwareId: 47,
current: 1,
size: 20
}
2025-03-18 20:20:37 +08:00
});
}
// 获取AI修复建议
2025-03-19 21:43:36 +08:00
export function getRepairInfo(data) {
2025-03-18 20:20:37 +08:00
return request({
url: '/api/v1/repo/repair/info',
2025-03-18 22:01:02 +08:00
method: 'POST',
2025-03-19 21:43:36 +08:00
data
2025-03-18 22:01:02 +08:00
});
}
2025-03-26 17:52:03 +08:00
// 可信软件详情-AI 修复建议接口
export const remediationSearchRemediations = (data): Promise<any> => {
return reqCatchV2(() =>
request({
url: '/api/v1/repo/repair/info',
method: 'POST',
data
})
);
};
2025-03-18 22:01:02 +08:00
// 获取许可证列表
2025-03-21 09:49:58 +08:00
export function getLicenseList(data) {
2025-03-18 22:01:02 +08:00
return request({
url: '/api/v1/repo/license/info',
method: 'POST',
2025-03-21 09:49:58 +08:00
data
2025-03-19 10:08:49 +08:00
});
}
// 获取详情漏洞列表
export function getVulnerabilityList() {
return request({
url: '/api/v1/repo/vulnerability/page',
method: 'GET',
params: {
current: 1,
size: 10,
softwareId: 47
2025-03-18 22:01:02 +08:00
}
2025-03-18 20:20:37 +08:00
});
}
2025-03-19 10:44:39 +08:00
2025-03-19 10:34:17 +08:00
// 获取漏洞数据
export const getVulnList = (data): Promise<any> => {
return reqCatchV2(() =>
request({
url: `/api/v1/repo/vulnerability/page`,
method: 'post',
2025-03-19 12:08:19 +08:00
data
2025-03-19 10:34:17 +08:00
})
);
2025-03-19 12:08:19 +08:00
};
2025-03-19 10:34:17 +08:00
2025-03-19 12:31:02 +08:00
// 获取SBOM依赖树
2025-03-19 21:47:34 +08:00
export const dependencyTree = (data: any): Promise<any> => {
2025-03-19 12:31:02 +08:00
return reqCatchV2(() =>
request({
url: `/api/v1/repo/dependency/tree`,
method: 'POST',
2025-03-19 21:47:34 +08:00
data
2025-03-19 12:31:02 +08:00
})
);
};
2025-03-19 13:04:13 +08:00
// 获取开发者社区信息
export const communityInfo = (softwareId: any): Promise<any> => {
return reqCatchV2(() =>
request({
url: `/api/v1/repo/community/info`,
method: 'POST',
data: {
softwareId
}
})
);
};
2025-03-19 12:31:02 +08:00
// 编辑用户信息(包含订阅默认预警方式)
export const userEdit = (data: any): Promise<any> => {
return reqCatchV2(() =>
request({
url: `/api/v1/user/edit`,
method: 'POST',
data
})
);
};
2025-03-19 10:34:17 +08:00
// 获取漏洞数据
export const getVulnDetail = (data): Promise<any> => {
return reqCatchV2(() =>
request({
url: `/api/v1/repo/vulnerability/info`,
method: 'POST',
2025-03-19 12:08:19 +08:00
data
2025-03-19 10:34:17 +08:00
})
);
2025-03-19 12:31:02 +08:00
};
2025-03-19 10:44:39 +08:00
// 迁移批量导入
2025-03-19 12:31:02 +08:00
export function repoImport(data: types.commonRepoReqType) {
2025-03-19 10:44:39 +08:00
return reqCatchV2(() =>
request({
url: `/api/v1/home/software/valid`,
method: 'post',
data,
headers: {
2025-03-19 12:31:02 +08:00
'Content-Type': 'multipart/form-data' // 设置请求头
}
2025-03-19 10:44:39 +08:00
})
);
}
2025-03-19 11:14:12 +08:00
// 个人中心-获取预警列表
export const getNoticeList = (data): Promise<any> => {
return reqCatchV2(() =>
request({
url: `/api/v1/alert/notice/list`,
method: 'POST',
2025-03-19 12:31:02 +08:00
data
2025-03-19 11:14:12 +08:00
})
);
2025-03-19 12:31:02 +08:00
};
2025-03-19 11:14:12 +08:00
// 个人中心-获取组织级预警列表
export const getgroupNoticeList = (data): Promise<any> => {
return reqCatchV2(() =>
request({
url: `/api/v1/alert/group/notice/list`,
method: 'POST',
2025-03-19 12:31:02 +08:00
data
2025-03-19 11:14:12 +08:00
})
);
2025-03-19 12:31:02 +08:00
};
2025-03-19 12:34:08 +08:00
// 个人中心-获取订阅列表
export const getSubscribeList = (data): Promise<any> => {
return reqCatchV2(() =>
request({
url: `/api/v1/alert/subscribe/list`,
method: 'POST',
data,
})
);
}
// 个人中心-获取组织级订阅列表
export const getGroupSubscribeList = (data): Promise<any> => {
return reqCatchV2(() =>
request({
url: `/api/v1/alert/group/subscribe/list`,
method: 'POST',
data,
2025-03-19 10:44:39 +08:00
})
);
}
2025-03-26 10:14:40 +08:00
// 搜索结果导出接口
export const getReleaseExport = (data): Promise<any> => {
return reqCatchV2(() =>
request({
url: `/api/v1/repo/release/export`,
method: 'POST',
data,
responseType: 'blob' // 关键告诉axios这是二进制数据
})
);
}
2025-03-26 20:09:09 +08:00
// 获取AI修复建议
export function getVulSuggestion(data) {
return request({
url: `/ai/vul_suggestion`,
2025-03-26 20:09:09 +08:00
method: 'POST',
data,
});
// return axios.request({
// url: '/gateway/detect' + `/ai/vul_suggestion`,
// method: 'POST',
// data,
// headers: {
// Authorization: 'Bearer ' + localStorage.getItem('op_access_token'),
// },
// });
2025-03-26 20:09:09 +08:00
}
2025-03-27 09:47:34 +08:00
// 许可证信息详情
export const getLicenseDetail = ({ id }): Promise<any> => {
return reqCatchV2(() =>
request({
url: `/api/v1/repo/license/detail/${id}`,
method: 'get',
})
);
};
2025-03-28 14:47:07 +08:00
// 是否订阅
export const alertIsSubscribe = (data): Promise<any> => {
return reqCatchV2(() =>
request({
url: `/api/v1/alert/isSubscribe`,
method: 'POST',
data,
})
);
};
// 获取邀请历史
export function getInviteHistoryData(): catchRt<any> {
return reqCatchV2(() =>
request(
{
url: `/api/v1/group/member/invite/history`,
method: 'get'
},
{
customError: true
}
)
);
}
// 删除个人邀请历史记录
export function acceptHistoryDelete(params): catchRt<any> {
return reqCatchV2(() =>
request(
{
url: '/api/v1/group/member/invite/history/delete',
method: 'post',
data: params
},
{
customError: true
}
)
);
}
export function addEnterprise(params) {
return request({
url: `enterprise/add`,
method: 'post',
data: params,
});
}
export function uploadImage(file: File) {
const formData = new FormData();
formData.append('file', file);
return request({
url: `enterprise/uploadPackage`,
method: 'post',
data: formData,
headers: {
'Content-Type': 'multipart/form-data',
Authorization: 'Bearer ' + localStorage.getItem('op_access_token')
}
});
// return axios.request({
// url: '/gateway/detect' + `/enterprise/uploadPackage`,
// method: 'POST',
// data: formData,
// headers: {
// 'Content-Type': 'multipart/form-data',
// Authorization: 'Bearer ' + localStorage.getItem('op_access_token')
// }
// });
}
// 获取字典
export function basicDict(data) {
return request({
url: `dict/children/list`,
method: 'post',
data: data,
});
}
/*AI大模型接口*/
// 1. 创建对话
export function fetchCreateConversation(data) {
return request({
url: `/agentHelper/api/createConversation`,
method: 'post',
data: data,
});
}
// 2. 对话
export function fetchChatUseSql(data) {
return request({
url: `/agentHelper/api/v0/chat_use_sql`,
method: 'post',
data: data,
});
}
// 3. 查询会话列表
export function fetchConversationList(data) {
return request({
url: `/agentHelper/api/conversationList`,
method: 'post',
data: data,
});
}
// 4. 查询会话详情
export function fetchConversationDetail(params) {
return request({
url: `/agentHelper/api/conversationDetail`,
method: 'get',
params: params,
});
}
// 5. 获取推荐问题
export function FetchFollowupQuestions(data) {
return request({
url: `/agentHelper/api/v0/provide_followup_questions`,
method: 'post',
data: data,
});
}
// 6. 修改会话标题
export function fetchChangeConversationTitle(data) {
return request({
url: `/agentHelper/api/changeConversationTitle`,
method: 'post',
data: data,
});
}
// 7. 修改会话的收藏状态
export function fetchToggleConversationCollect(data) {
return request({
url: `/agentHelper/api/toggleConversationCollect`,
method: 'post',
data: data,
});
}
// 8. 删除对话
export function fetchDeleteConversation(data) {
return request({
url: `/agentHelper/api/deleteConversation`,
method: 'post',
data: data,
});
}
// 9. 首页推荐问题
export function fetchUpdateRecommendQuestions(data) {
return request({
url: `/agentHelper/api/v0/update_recommend_questions`,
method: 'post',
data: data,
});
}
export function qualityTaskOverview(data) {
const {softwareId} = data;
return axios.request({
url: `/gateway/quality/task-overview/software` + `/${softwareId}`,
method: 'GET',
// headers: {
// Authorization: 'Bearer ' + localStorage.getItem('op_access_token'),
// }
});
}
export function qualityDefectPage(data) {
const {pageNum,pageSize,softwareId} = data;
return axios.request({
url: `/gateway/quality/defect/page` + `?pageNum=${pageNum}&pageSize=${pageSize}&softwareId=${softwareId}`,
method: 'GET',
// headers: {
// Authorization: 'Bearer ' + localStorage.getItem('op_access_token'),
// }
});
}
export function loginAccess() {
return axios.request({
url: `/gateway/u-auth/login-access`,
method: 'POST',
data: {},
headers: {
Authorization: 'Bearer ' + localStorage.getItem('op_access_token'),
}
});
}
// 查询用户是否认证
export function fetchCheckAuthenticate(data) {
return request({
url: `/api/v1/user/checkAuthenticate`,
method: 'post',
data: data,
});
}